PM / devfreq: mtk-cci: Fix potential error pointer dereference in probe()
Subsystems (3)
PATCH 1/1 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 <[email protected]>
--- drivers/devfreq/mtk-cci-devfreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/devfreq/mtk-cci-devfreq.c +2 -1
@@ -386,7 +386,8 @@ static int mtk_ccifreq_probe(struct platform_device *pdev) out_free_resources:if (regulator_is_enabled (drv->proc_reg))regulator_disable (drv->proc_reg); -if (drv->sram_reg &®ulator_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;
Signature · 1 line
2.47.2