All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] opp: Allow dev_pm_opp_set_opp() to be called without opp
@ 2021-01-28  4:04 Bjorn Andersson
  2021-01-28  4:21 ` Viresh Kumar
  0 siblings, 1 reply; 2+ messages in thread
From: Bjorn Andersson @ 2021-01-28  4:04 UTC (permalink / raw)
  To: Viresh Kumar, Nishanth Menon, Stephen Boyd
  Cc: linux-pm, linux-kernel, linux-arm-msm

a6xx_gmu_stop() calls dev_pm_opp_set_opp() with NULL as opp in order to
drop its bandwidth request, which was valid with dev_pm_opp_set_bw().
But after the transition to dev_pm_opp_set_opp() this leads to a NULL
dereference before jumping into _set_opp(), which does disable the
vote as expected.

Fixes: a0d67b94e2ef ("opp: Implement dev_pm_opp_set_opp()")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/opp/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 583bb1274df9..3ff05f40e443 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1157,7 +1157,7 @@ int dev_pm_opp_set_opp(struct device *dev, struct dev_pm_opp *opp)
 		return PTR_ERR(opp_table);
 	}
 
-	ret = _set_opp(dev, opp_table, opp, opp->rate);
+	ret = _set_opp(dev, opp_table, opp, opp ? opp->rate : 0);
 	dev_pm_opp_put_opp_table(opp_table);
 
 	return ret;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] opp: Allow dev_pm_opp_set_opp() to be called without opp
  2021-01-28  4:04 [PATCH] opp: Allow dev_pm_opp_set_opp() to be called without opp Bjorn Andersson
@ 2021-01-28  4:21 ` Viresh Kumar
  0 siblings, 0 replies; 2+ messages in thread
From: Viresh Kumar @ 2021-01-28  4:21 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Viresh Kumar, Nishanth Menon, Stephen Boyd, linux-pm,
	linux-kernel, linux-arm-msm

On 27-01-21, 20:04, Bjorn Andersson wrote:
> a6xx_gmu_stop() calls dev_pm_opp_set_opp() with NULL as opp in order to
> drop its bandwidth request, which was valid with dev_pm_opp_set_bw().
> But after the transition to dev_pm_opp_set_opp() this leads to a NULL
> dereference before jumping into _set_opp(), which does disable the
> vote as expected.
> 
> Fixes: a0d67b94e2ef ("opp: Implement dev_pm_opp_set_opp()")
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>  drivers/opp/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 583bb1274df9..3ff05f40e443 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -1157,7 +1157,7 @@ int dev_pm_opp_set_opp(struct device *dev, struct dev_pm_opp *opp)
>  		return PTR_ERR(opp_table);
>  	}
>  
> -	ret = _set_opp(dev, opp_table, opp, opp->rate);
> +	ret = _set_opp(dev, opp_table, opp, opp ? opp->rate : 0);
>  	dev_pm_opp_put_opp_table(opp_table);
>  
>  	return ret;

I specially handled this case with care and still missed this :(

I have updated the original patch to fix it, thanks.

-- 
viresh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-28  4:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-28  4:04 [PATCH] opp: Allow dev_pm_opp_set_opp() to be called without opp Bjorn Andersson
2021-01-28  4:21 ` Viresh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.