[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191016090628.7l5u4ytdqr2jlasg@pengutronix.de>
Date: Wed, 16 Oct 2019 11:06:28 +0200
From: Marco Felsch <m.felsch@...gutronix.de>
To: Chuhong Yuan <hslester96@...il.com>
Cc: devel@...verdev.osuosl.org, Fabio Estevam <festevam@...il.com>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
linux-kernel@...r.kernel.org, Rui Miguel Silva <rmfrfs@...il.com>,
NXP Linux Team <linux-imx@....com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Steve Longerbeam <slongerbeam@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Shawn Guo <shawnguo@...nel.org>,
linux-arm-kernel@...ts.infradead.org, linux-media@...r.kernel.org
Subject: Re: [PATCH v2] media: imx7-mipi-csis: Add a check for
devm_regulator_get
Hi Chuhong,
On 19-10-15 21:59, Chuhong Yuan wrote:
> 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: Chuhong Yuan <hslester96@...il.com>
> ---
> Changes in v2:
> - Add a check in mipi_csis_probe for the modified mipi_csis_phy_init.
Did you miss the check for -EPROBE_DEFER?
Regards,
Marco
>
> drivers/staging/media/imx/imx7-mipi-csis.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c
> index 73d8354e618c..e8a6acaa969e 100644
> --- a/drivers/staging/media/imx/imx7-mipi-csis.c
> +++ b/drivers/staging/media/imx/imx7-mipi-csis.c
> @@ -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);
> @@ -966,7 +968,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);
>
> mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> --
> 2.20.1
>
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Powered by blists - more mailing lists