* [PATCH] soc: qcom: icc-bwmon: fix incorrect error code passed to dev_err_probe()
@ 2023-05-13 11:17 Krzysztof Kozlowski
2023-05-15 3:33 ` Bjorn Andersson
0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2023-05-13 11:17 UTC (permalink / raw)
To: Krzysztof Kozlowski, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Thara Gopinath, linux-arm-msm, linux-kernel
Cc: kernel test robot, Dan Carpenter, stable
Pass to dev_err_probe() PTR_ERR from actual dev_pm_opp_find_bw_floor()
call which failed, instead of previous ret which at this point is 0.
Failure of dev_pm_opp_find_bw_floor() would result in prematurely ending
the probe with success.
Fixes smatch warnings:
drivers/soc/qcom/icc-bwmon.c:776 bwmon_probe() warn: passing zero to 'dev_err_probe'
drivers/soc/qcom/icc-bwmon.c:781 bwmon_probe() warn: passing zero to 'dev_err_probe'
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/202305131657.76XeHDjF-lkp@intel.com/
Cc: <stable@vger.kernel.org>
Fixes: b9c2ae6cac40 ("soc: qcom: icc-bwmon: Add bandwidth monitoring driver")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
Code was tested previously with smatch. Just this test in smatch is new.
---
drivers/soc/qcom/icc-bwmon.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/qcom/icc-bwmon.c b/drivers/soc/qcom/icc-bwmon.c
index fd58c5b69897..f65bfeca7ed6 100644
--- a/drivers/soc/qcom/icc-bwmon.c
+++ b/drivers/soc/qcom/icc-bwmon.c
@@ -773,12 +773,12 @@ static int bwmon_probe(struct platform_device *pdev)
bwmon->max_bw_kbps = UINT_MAX;
opp = dev_pm_opp_find_bw_floor(dev, &bwmon->max_bw_kbps, 0);
if (IS_ERR(opp))
- return dev_err_probe(dev, ret, "failed to find max peak bandwidth\n");
+ return dev_err_probe(dev, PTR_ERR(opp), "failed to find max peak bandwidth\n");
bwmon->min_bw_kbps = 0;
opp = dev_pm_opp_find_bw_ceil(dev, &bwmon->min_bw_kbps, 0);
if (IS_ERR(opp))
- return dev_err_probe(dev, ret, "failed to find min peak bandwidth\n");
+ return dev_err_probe(dev, PTR_ERR(opp), "failed to find min peak bandwidth\n");
bwmon->dev = dev;
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] soc: qcom: icc-bwmon: fix incorrect error code passed to dev_err_probe()
2023-05-13 11:17 [PATCH] soc: qcom: icc-bwmon: fix incorrect error code passed to dev_err_probe() Krzysztof Kozlowski
@ 2023-05-15 3:33 ` Bjorn Andersson
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Andersson @ 2023-05-15 3:33 UTC (permalink / raw)
To: Krzysztof Kozlowski, Thara Gopinath, linux-kernel, linux-arm-msm,
Andy Gross, Konrad Dybcio
Cc: kernel test robot, stable, Dan Carpenter
On Sat, 13 May 2023 13:17:47 +0200, Krzysztof Kozlowski wrote:
> Pass to dev_err_probe() PTR_ERR from actual dev_pm_opp_find_bw_floor()
> call which failed, instead of previous ret which at this point is 0.
> Failure of dev_pm_opp_find_bw_floor() would result in prematurely ending
> the probe with success.
>
> Fixes smatch warnings:
>
> [...]
Applied, thanks!
[1/1] soc: qcom: icc-bwmon: fix incorrect error code passed to dev_err_probe()
commit: 3530167c6fe8001de6c026a3058eaca4c8a5329f
Best regards,
--
Bjorn Andersson <andersson@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-15 3:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-13 11:17 [PATCH] soc: qcom: icc-bwmon: fix incorrect error code passed to dev_err_probe() Krzysztof Kozlowski
2023-05-15 3:33 ` Bjorn Andersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®