[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGTfZH0jQ7j7_u=tMpe32n8RzG5sZk7ze5vOAnkbh5mxmba_EA@mail.gmail.com>
Date: Wed, 14 May 2025 02:43:53 +0900
From: Chanwoo Choi <chanwoo@...nel.org>
To: Lifeng Zheng <zhenglifeng1@...wei.com>
Cc: myungjoo.ham@...sung.com, kyungmin.park@...sung.com, cw00.choi@...sung.com,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org, linuxarm@...wei.com,
jonathan.cameron@...wei.com, zhanjie9@...ilicon.com, lihuisong@...wei.com,
yubowen8@...wei.com, cenxinghai@...artners.com
Subject: Re: [PATCH 4/4] PM / devfreq: Check governor before using governor->name
Hi,
Applied it. Thanks.
On Mon, Apr 21, 2025 at 12:01 PM Lifeng Zheng <zhenglifeng1@...wei.com> wrote:
>
> Commit 96ffcdf239de ("PM / devfreq: Remove redundant governor_name from
> struct devfreq") removes governor_name and uses governor->name to replace
> it. But devfreq->governor may be NULL and directly using
> devfreq->governor->name may cause null pointer exception. Move the check of
> governor to before using governor->name.
>
> Fixes: 96ffcdf239de ("PM / devfreq: Remove redundant governor_name from struct devfreq")
> Signed-off-by: Lifeng Zheng <zhenglifeng1@...wei.com>
> ---
> drivers/devfreq/devfreq.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 18e3f7e063a4..46f3a8053197 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -1376,15 +1376,11 @@ int devfreq_remove_governor(struct devfreq_governor *governor)
> int ret;
> struct device *dev = devfreq->dev.parent;
>
> + if (!devfreq->governor)
> + continue;
> +
> if (!strncmp(devfreq->governor->name, governor->name,
> DEVFREQ_NAME_LEN)) {
> - /* we should have a devfreq governor! */
> - if (!devfreq->governor) {
> - dev_warn(dev, "%s: Governor %s NOT present\n",
> - __func__, governor->name);
> - continue;
> - /* Fall through */
> - }
> ret = devfreq->governor->event_handler(devfreq,
> DEVFREQ_GOV_STOP, NULL);
> if (ret) {
> --
> 2.33.0
>
>
--
Best Regards,
Chanwoo Choi
Samsung Electronics
Powered by blists - more mailing lists