[PATCH] cpufreq: Make cpufreq_unregister_driver() return void

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Wed Feb 8 08:56:33 PST 2023


Hello,

On Wed, Feb 08, 2023 at 04:04:57PM +0000, Wyes Karny wrote:
> On 07 Feb 20:59, Uwe Kleine-König wrote:
> > All but a few drivers ignore the return value of
> > cpufreq_unregister_driver(). Those few that don't only call it after
> > cpufreq_register_driver() succeeded, in which case the call doesn't
> > fail.
> > 
> > Make the function return no value and add a WARN_ON for the case that
> > the function is called in an invalid situation (i.e. without a previous
> > successful call to cpufreq_register_driver()).
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> > ---
> >  drivers/cpufreq/brcmstb-avs-cpufreq.c | 5 +----
> >  drivers/cpufreq/cpufreq.c             | 8 +++-----
> >  drivers/cpufreq/davinci-cpufreq.c     | 4 +++-
> >  drivers/cpufreq/mediatek-cpufreq-hw.c | 4 +++-
> >  drivers/cpufreq/omap-cpufreq.c        | 4 +++-
> >  drivers/cpufreq/qcom-cpufreq-hw.c     | 4 +++-
> >  include/linux/cpufreq.h               | 2 +-
> >  7 files changed, 17 insertions(+), 14 deletions(-)
> 
> > base-commit: 05ecb680708a1dbe6554d6fc17e5d9a8a7cb5e6a
> 
> You may have to rebase it on top of this [1].
> Recently this patch series was picked up by Rafael.
> You have to add the below hunk in your patch.
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 168a28bed6ee..70debd5a9f40 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -831,7 +831,7 @@ static void amd_pstate_driver_cleanup(void)
> 
>  static int amd_pstate_update_status(const char *buf, size_t size)
>  {
> -       int ret;
> +       int ret = 0;
>         int mode_idx;
> 
>         if (size > 7 || size < 6)
> @@ -844,7 +844,7 @@ static int amd_pstate_update_status(const char *buf,
> size_t size)
>                         return -EINVAL;
>                 if (cppc_state == AMD_PSTATE_ACTIVE)
>                         return -EBUSY;
> -               ret = cpufreq_unregister_driver(current_pstate_driver);
> +               cpufreq_unregister_driver(current_pstate_driver);
>                 amd_pstate_driver_cleanup();
>                 break;
>         case AMD_PSTATE_PASSIVE:

Good catch. The adaption looks right. @Rafael, please tell me, if you
want me to adapt my patch and resend.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20230208/629034cb/attachment.sig>


More information about the Linux-mediatek mailing list