Skip to content

Commit fc33bf0

Browse files
Dan Carpenterchanwoochoi
authored andcommitted
PM / devfreq: mtk-cci: Fix potential error pointer dereference in probe()
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: e09bd57 ("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/
1 parent 1b237f1 commit fc33bf0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/devfreq/mtk-cci-devfreq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ static int mtk_ccifreq_probe(struct platform_device *pdev)
386386
out_free_resources:
387387
if (regulator_is_enabled(drv->proc_reg))
388388
regulator_disable(drv->proc_reg);
389-
if (drv->sram_reg && regulator_is_enabled(drv->sram_reg))
389+
if (!IS_ERR_OR_NULL(drv->sram_reg) &&
390+
regulator_is_enabled(drv->sram_reg))
390391
regulator_disable(drv->sram_reg);
391392

392393
return ret;

0 commit comments

Comments
 (0)