Skip to content

Commit

Permalink
clk: qcom: camcc-sc8280xp: Prevent error pointer dereference
Browse files Browse the repository at this point in the history
If "regmap" is an error pointer then calling regmap_update_bits() will
crash.  We only need to call regmap_update_bits() if we had written to
it earlier.

Fixes: ff93872 ("clk: qcom: camcc-sc8280xp: Add sc8280xp CAMCC")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
Link: https://lore.kernel.org/r/210d48ce-6ebc-4a6b-b30f-866d10d41a16@moroto.mountain
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
  • Loading branch information
Dan Carpenter authored and Bjorn Andersson committed Dec 16, 2023
1 parent f6bda45 commit df14d21
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/clk/qcom/camcc-sc8280xp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3017,14 +3017,15 @@ static int camcc_sc8280xp_probe(struct platform_device *pdev)

ret = qcom_cc_really_probe(pdev, &camcc_sc8280xp_desc, regmap);
if (ret)
goto err_put_rpm;
goto err_disable;

pm_runtime_put(&pdev->dev);

return 0;

err_put_rpm:
err_disable:
regmap_update_bits(regmap, 0xc1e4, BIT(0), 0);
err_put_rpm:
pm_runtime_put_sync(&pdev->dev);

return ret;
Expand Down

0 comments on commit df14d21

Please sign in to comment.