[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <m35x8aidff.fsf@t19.piap.pl>
Date: Fri, 06 Feb 2026 07:39:00 +0100
From: Krzysztof Hałasa <khalasa@...p.pl>
To: Chen Ni <nichen@...as.ac.cn>
Cc: <sakari.ailus@...ux.intel.com>, <mchehab@...nel.org>,
<linux-media@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] media: i2c: ar0521: Check return value of
devm_gpiod_get_optional() in ar0521_probe()
Hi Chen,
Chen Ni <nichen@...as.ac.cn> writes:
> The devm_gpiod_get_optional() function may return an error pointer
> (ERR_PTR) in case of a genuine failure during GPIO acquisition, not just
> NULL which indicates the legitimate absence of an optional GPIO.
Well, it seems only right. Though I would prefer all-caps "GPIO" in
kernel messages. Either way,
Acked-by: Krzysztof Hałasa <khalasa@...p.pl>
> --- a/drivers/media/i2c/ar0521.c
> +++ b/drivers/media/i2c/ar0521.c
> @@ -1094,6 +1094,9 @@ static int ar0521_probe(struct i2c_client *client)
> /* Request optional reset pin (usually active low) and assert it */
> sensor->reset_gpio = devm_gpiod_get_optional(dev, "reset",
> GPIOD_OUT_HIGH);
> + if (IS_ERR(sensor->reset_gpio))
> + return dev_err_probe(dev, PTR_ERR(sensor->reset_gpio),
> + "failed to get reset gpio\n");
>
> v4l2_i2c_subdev_init(&sensor->sd, client, &ar0521_subdev_ops);
>
--
Krzysztof "Chris" Hałasa
Sieć Badawcza Łukasiewicz
Przemysłowy Instytut Automatyki i Pomiarów PIAP
Al. Jerozolimskie 202, 02-486 Warszawa
Powered by blists - more mailing lists