lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMuHMdWSNYantcmNu+43Az8hVGDvXVFVG8pRVr38o-Mqx1AgKg@mail.gmail.com>
Date:   Thu, 2 Feb 2023 17:22:11 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     John Paul Adrian Glaubitz <glaubitz@...sik.fu-berlin.de>
Cc:     hkallweit1@...il.com, davem@...emloft.net, edumazet@...gle.com,
        kuba@...nel.org, netdev@...r.kernel.org, nic_swsd@...ltek.com,
        pabeni@...hat.com, linux-sh@...r.kernel.org,
        Yoshinori Sato <ysato@...rs.sourceforge.jp>,
        Rich Felker <dalias@...c.org>
Subject: Re: [PATCH net-next] r8169: use devm_clk_get_optional_enabled() to
 simplify the code

On Thu, Feb 2, 2023 at 5:09 PM Geert Uytterhoeven <geert@...ux-m68k.org> wrote:
> On Thu, Feb 2, 2023 at 3:11 PM John Paul Adrian Glaubitz
> <glaubitz@...sik.fu-berlin.de> wrote:
> > > Now that we have devm_clk_get_optional_enabled(), we don't have to
> > > open-code it.
> > >
> > > Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
>
> > > --- a/drivers/net/ethernet/realtek/r8169_main.c
> > > +++ b/drivers/net/ethernet/realtek/r8169_main.c
>
> > > @@ -5216,9 +5185,9 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
> > >               return -ENOMEM;
> > >
> > >       /* Get the *optional* external "ether_clk" used on some boards */
> > > -     rc = rtl_get_ether_clk(tp);
> > > -     if (rc)
> > > -             return rc;
> > > +     tp->clk = devm_clk_get_optional_enabled(&pdev->dev, "ether_clk");
> > > +     if (IS_ERR(tp->clk))
> > > +             return dev_err_probe(&pdev->dev, PTR_ERR(tp->clk), "failed to get ether_clk\n");
> > >
> > >       /* enable device (incl. PCI PM wakeup and hotplug setup) */
> > >       rc = pcim_enable_device(pdev);
> > > --
> > > 2.37.3
> >
> > This change broke the r8169 driver on my SH7785LCR SuperH Evaluation Board.
> >
> > With your patch, the driver initialization fails with:
> >
> > [    1.648000] r8169 0000:00:00.0: error -EINVAL: failed to get ether_clk
> > [    1.676000] r8169: probe of 0000:00:00.0 failed with error -22
> >
> > Any idea what could be the problem?
>
> SH's clk_enable() returns -EINVAL if clk == NULL, which is wrong.
> Preparing a patch...

https://lore.kernel.org/r/b53e6b557b4240579933b3359dda335ff94ed5af.1675354849.git.geert+renesas@glider.be

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ