Commit a0219dee authored by Chuhong Yuan's avatar Chuhong Yuan Committed by Mauro Carvalho Chehab

media: imx7-mipi-csis: Add a check for devm_regulator_get

devm_regulator_get may return an error but mipi_csis_phy_init misses
a check for it.
This may lead to problems when regulator_set_voltage uses the unchecked
pointer.
This patch adds a check for devm_regulator_get to avoid potential risk.
Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
Reviewed-by: default avatarRui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 61c03b63
......@@ -350,6 +350,8 @@ static void mipi_csis_sw_reset(struct csi_state *state)
static int mipi_csis_phy_init(struct csi_state *state)
{
state->mipi_phy_regulator = devm_regulator_get(state->dev, "phy");
if (IS_ERR(state->mipi_phy_regulator))
return PTR_ERR(state->mipi_phy_regulator);
return regulator_set_voltage(state->mipi_phy_regulator, 1000000,
1000000);
......@@ -956,7 +958,10 @@ static int mipi_csis_probe(struct platform_device *pdev)
return ret;
}
mipi_csis_phy_init(state);
ret = mipi_csis_phy_init(state);
if (ret < 0)
return ret;
mipi_csis_phy_reset(state);
state->regs = devm_platform_ioremap_resource(pdev, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment