summaryrefslogtreecommitdiff
path: root/drivers/devfreq
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2025-08-07 18:58:23 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-15 12:03:25 +0200
commit24d61b6e23d2c7291c528dd43a0bf76b5c05c8f0 (patch)
tree40c98ddaf276b0efe026ceef8bedd6fd638c8db3 /drivers/devfreq
parent07d8d3b1ad44656bcf5adf9e6fe6dd8d3a45464e (diff)
downloadlinux-24d61b6e23d2c7291c528dd43a0bf76b5c05c8f0.tar.gz
linux-24d61b6e23d2c7291c528dd43a0bf76b5c05c8f0.tar.bz2
linux-24d61b6e23d2c7291c528dd43a0bf76b5c05c8f0.zip
PM / devfreq: mtk-cci: Fix potential error pointer dereference in probe()
[ Upstream commit fc33bf0e097c6834646b98a7b3da0ae5b617f0f9 ] The drv->sram_reg pointer could be set to ERR_PTR(-EPROBE_DEFER) which would lead to a error pointer dereference. Use IS_ERR_OR_NULL() to check that the pointer is valid. Fixes: e09bd5757b52 ("PM / devfreq: mtk-cci: Handle sram regulator probe deferral") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Link: https://patchwork.kernel.org/project/linux-pm/patch/aJTNHz8kk8s6Q2os@stanley.mountain/ Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r--drivers/devfreq/mtk-cci-devfreq.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/devfreq/mtk-cci-devfreq.c b/drivers/devfreq/mtk-cci-devfreq.c
index 22fe9e631f8a..5730076846e1 100644
--- a/drivers/devfreq/mtk-cci-devfreq.c
+++ b/drivers/devfreq/mtk-cci-devfreq.c
@@ -386,7 +386,8 @@ out_disable_cci_clk:
out_free_resources:
if (regulator_is_enabled(drv->proc_reg))
regulator_disable(drv->proc_reg);
- if (drv->sram_reg && regulator_is_enabled(drv->sram_reg))
+ if (!IS_ERR_OR_NULL(drv->sram_reg) &&
+ regulator_is_enabled(drv->sram_reg))
regulator_disable(drv->sram_reg);
return ret;