[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8de93390-ae04-4278-bb34-aa175c659c23@st.com>
Date: Thu, 17 Oct 2019 05:43:24 +0000
From: Mickael GUENE <mickael.guene@...com>
To: Chuhong Yuan <hslester96@...il.com>
CC: Mauro Carvalho Chehab <mchehab@...nel.org>,
"linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] media: st-mipid02: add a check for
devm_gpiod_get_optional
Hello Chuhong,
Is this check necessary ?
since looking into code it seems to me devm_gpiod_get_optional() can only
return NULL in case of error due to following check in devm_gpiod_get_index_optional()
if (IS_ERR(desc)) {
if (PTR_ERR(desc) == -ENOENT)
return NULL;
}
And in that case reset_gpio is not used
Regards
Mickael
On 10/16/19 12:56, Chuhong Yuan wrote:
> mipid02_probe misses a check for devm_gpiod_get_optional and may miss
> the failure.
> Add a check to fix the problem.
>
> Signed-off-by: Chuhong Yuan <hslester96@...il.com>
> ---
> drivers/media/i2c/st-mipid02.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c
> index 81285b8d5cfb..d38e888b0a43 100644
> --- a/drivers/media/i2c/st-mipid02.c
> +++ b/drivers/media/i2c/st-mipid02.c
> @@ -971,6 +971,9 @@ static int mipid02_probe(struct i2c_client *client)
> bridge->reset_gpio = devm_gpiod_get_optional(dev, "reset",
> GPIOD_OUT_HIGH);
>
> + if (IS_ERR(bridge->reset_gpio))
> + return PTR_ERR(bridge->reset_gpio);
> +
> ret = mipid02_get_regulators(bridge);
> if (ret) {
> dev_err(dev, "failed to get regulators %d", ret);
>
Powered by blists - more mailing lists