[PATCH] cpufreq: Make cpufreq_unregister_driver() return void

Wyes Karny wyes.karny at amd.com
Wed Feb 8 08:04:57 PST 2023


Hi Uwe Kleine-König,

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:


Otherwise the patch looks good to me.

[1]: https://lore.kernel.org/linux-pm/20230131090016.3970625-1-perry.yuan@amd.com/#t

Thanks,
Wyes
> -- 
> 2.39.0
> 



More information about the linux-arm-kernel mailing list