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]
Date:   Fri, 22 Sep 2023 09:26:35 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Lee Jones <lee@...nel.org>
Cc:     zhangshida <starzhangzsd@...il.com>, linux-kernel@...r.kernel.org,
        zhangshida@...inos.cn, k2ci <kernel-bot@...inos.cn>
Subject: Re: [PATCH] mfd: cs42l43: fix defined but not used warnings

Hi Lee,

On Wed, Sep 20, 2023 at 12:07 PM Lee Jones <lee@...nel.org> wrote:
> On Tue, 05 Sep 2023, zhangshida wrote:
> > From: Shida Zhang <zhangshida@...inos.cn>
> >
> > Warnings were generated during compiling for functions like
> > cs42l43_*_{resume,suspend}:
> >
> > ../drivers/mfd/cs42l43.c:1138:12: error: ‘cs42l43_runtime_resume’ defined but not used [-Werror=unused-function]
> >  1138 | static int cs42l43_runtime_resume(struct device *dev)
> >       |            ^~~~~~~~~~~~~~~~~~~~~~
> > ../drivers/mfd/cs42l43.c:1124:12: error: ‘cs42l43_runtime_suspend’ defined but not used [-Werror=unused-function]
> >  1124 | static int cs42l43_runtime_suspend(struct device *dev)
> >       |            ^~~~~~~~~~~~~~~~~~~~~~~
> > ../drivers/mfd/cs42l43.c:1106:12: error: ‘cs42l43_resume’ defined but not used [-Werror=unused-function]
> >  1106 | static int cs42l43_resume(struct device *dev)
> >       |            ^~~~~~~~~~~~~~
> > ../drivers/mfd/cs42l43.c:1076:12: error: ‘cs42l43_suspend’ defined but not used [-Werror=unused-function]
> >  1076 | static int cs42l43_suspend(struct device *dev)
> >
> > Fix it by guarding it with CONFIG_PM/CONFIG_PM_SLEEP.
> >
> > Reported-by: k2ci <kernel-bot@...inos.cn>
> > Signed-off-by: Shida Zhang <zhangshida@...inos.cn>
> > ---
> >  drivers/mfd/cs42l43.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/mfd/cs42l43.c b/drivers/mfd/cs42l43.c
> > index 37b23e9bae82..e589a61c118d 100644
> > --- a/drivers/mfd/cs42l43.c
> > +++ b/drivers/mfd/cs42l43.c
> > @@ -1073,6 +1073,7 @@ void cs42l43_dev_remove(struct cs42l43 *cs42l43)
> >  }
> >  EXPORT_SYMBOL_NS_GPL(cs42l43_dev_remove, MFD_CS42L43);
> >
> > +#ifdef CONFIG_PM_SLEEP
> >  static int cs42l43_suspend(struct device *dev)
> >  {
> >       struct cs42l43 *cs42l43 = dev_get_drvdata(dev);
> > @@ -1120,7 +1121,9 @@ static int cs42l43_resume(struct device *dev)
> >
> >       return 0;
> >  }
> > +#endif
> >
> > +#ifdef CONFIG_PM
> >  static int cs42l43_runtime_suspend(struct device *dev)
> >  {
> >       struct cs42l43 *cs42l43 = dev_get_drvdata(dev);
> > @@ -1176,6 +1179,7 @@ static int cs42l43_runtime_resume(struct device *dev)
> >
> >       return ret;
> >  }
> > +#endif
> >
> >  EXPORT_NS_GPL_DEV_PM_OPS(cs42l43_pm_ops, MFD_CS42L43) = {
> >       SET_SYSTEM_SLEEP_PM_OPS(cs42l43_suspend, cs42l43_resume)
>
> I see a bunch of drivers using PM helpers and not many of them are
> are being guarded by ugly #ifery.  Please find out what they're doing to
> solve the same issue and replicate that instead.
>
> Here's a really big hint:
>
>   `git log --oneline 02313a90095fb`

And there's no need to create another fix, as a Good Old fix is
available (and still not upstream):
https://lore.kernel.org/all/20230822114914.340359-1-ckeepax@opensource.cirrus.com

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