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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdUW0UcPDJcw8A4imPfVc5ywbMGuORungaeSk9j0omAjfQ@mail.gmail.com>
Date:   Fri, 27 Sep 2019 21:10:13 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Stephen Boyd <sboyd@...nel.org>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Andy Gross <agross@...nel.org>,
        Jassi Brar <jassisinghbrar@...il.com>,
        Niklas Cassel <niklas.cassel@...aro.org>,
        Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@...aro.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Jassi Brar <jaswinder.singh@...aro.org>,
        linux-arm-msm <linux-arm-msm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mbox: qcom: avoid unused-variable warning

Hi Stephen,

On Fri, Sep 27, 2019 at 8:26 PM Stephen Boyd <sboyd@...nel.org> wrote:
> Quoting Geert Uytterhoeven (2019-09-26 06:07:13)
> > On Fri, Sep 20, 2019 at 11:06 PM Stephen Boyd <sboyd@...nel.org> wrote:
> > > Quoting Arnd Bergmann (2019-09-20 12:27:50)
> > > > On Fri, Sep 20, 2019 at 6:45 PM Stephen Boyd <sboyd@...nel.org> wrote:
> > > > > > @@ -54,11 +60,6 @@ static int qcom_apcs_ipc_probe(struct platform_device *pdev)
> > > > > >         void __iomem *base;
> > > > > >         unsigned long i;
> > > > > >         int ret;
> > > > > > -       const struct of_device_id apcs_clk_match_table[] = {
> > > > >
> > > > > Does marking it static here work too? It would be nice to limit the
> > > > > scope of this variable to this function instead of making it a global.
> > > > > Also, it might be slightly smaller code size if that works.
> > > >
> > > > No, I just tried and the warning returned.
> >
> > It's there for the convenience for the user, so he doesn't have to add it
> > himself explicitly.
> >
> > > ("of/device: Nullify match table in of_match_device() for CONFIG_OF=n"),
> > > but it's been 5 years! Surely we can revert this change now that commit
> > > 219a7bc577e6 ("spi: rspi: Use of_device_get_match_data() helper") is
> > > merged.
> >
> > Right, the particular error case in the RSPI driver can no longer happen.
> >
> > Calling of_device_get_match_data() is the better solution anyway, as
> > that uses the match table stored in dev->driver->of_match_table, so
> > there's no need to pass the table explicitly, and conditionally.
> >
> > Hence...
> >
> > > --- a/drivers/leds/leds-pca9532.c
> > > +++ b/drivers/leds/leds-pca9532.c
> > > @@ -472,7 +472,7 @@ pca9532_of_populate_pdata(struct device *dev, struct device_node *np)
> > >         int i = 0;
> > >         const char *state;
> > >
> > > -       match = of_match_device(of_pca9532_leds_match, dev);
> > > +       match = of_match_device(of_match_ptr(of_pca9532_leds_match), dev);
> > >         if (!match)
> > >                 return ERR_PTR(-ENODEV);
> >
> > Please convert to of_device_get_match_data() instead of adding
> > of_match_ptr() invocations...
>
> How is this workable? I left it as of_match_device() because the value
> returned may be 0 for the enum and that looks the same as NULL.

This function is used for the DT case only, so there will always be a match.
Hence you can do devid = (int)(uintptr_t)of_device_get_match_data(dev).

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