]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
soc: qcom: icc-bwmon: Fix handling dev_pm_opp_find_bw_*() errors
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Mon, 18 Aug 2025 12:38:52 +0000 (14:38 +0200)
committerBjorn Andersson <andersson@kernel.org>
Tue, 19 Aug 2025 02:28:06 +0000 (21:28 -0500)
commit13650cd32cfc640fbd49f0424640f64d57335d4c
tree4ec618ace04aad821062b7a0a796d7c34810788c
parent5d8a9c8401648d338d072a488d455ed4611c5d4b
soc: qcom: icc-bwmon: Fix handling dev_pm_opp_find_bw_*() errors

The ISR calls dev_pm_opp_find_bw_ceil(), which can return EINVAL, ERANGE
or ENODEV, and if that one fails with ERANGE, then it tries again with
floor dev_pm_opp_find_bw_floor().

In theory, following error paths are possible:
1. First dev_pm_opp_find_bw_ceil() failed with an error different than
   ERANGE,
2. Any error from second dev_pm_opp_find_bw_floor().

However in practice this would mean that there are no suitable OPPs at
all, which is already being checked in the drivers probe() function.
This is impossible condition.

Relying however in the interrupt handler bwmon_intr_thread() on
preconditions checked in probe() is not easy to follow from code
readability and is very difficult to handle in static analysis, thus
let's make the code just obvious to silence warning reported by Smatch:

  icc-bwmon.c:693 bwmon_intr_thread() error: 'target_opp' dereferencing possible ERR_PTR()

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/aJTNEQsRFjrFknG9@stanley.mountain/
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250818123851.111326-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/soc/qcom/icc-bwmon.c