Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 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/

authored by

Dan Carpenter and committed by
Chanwoo Choi
fc33bf0e 1b237f19

+2 -1
+2 -1
drivers/devfreq/mtk-cci-devfreq.c
··· 386 386 out_free_resources: 387 387 if (regulator_is_enabled(drv->proc_reg)) 388 388 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)) 390 391 regulator_disable(drv->sram_reg); 391 392 392 393 return ret;