public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: "Krzysztof Hałasa" <khalasa@piap.pl>
To: Chen Ni <nichen@iscas.ac.cn>
Cc: <sakari.ailus@linux.intel.com>,  <mchehab@kernel.org>,
	<linux-media@vger.kernel.org>,  <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] media: i2c: ar0521: Check return value of devm_gpiod_get_optional() in ar0521_probe()
Date: Fri, 06 Feb 2026 07:39:00 +0100	[thread overview]
Message-ID: <m35x8aidff.fsf@t19.piap.pl> (raw)
In-Reply-To: <20260130041815.2988011-1-nichen@iscas.ac.cn> (Chen Ni's message of "Fri, 30 Jan 2026 12:18:15 +0800")

Hi Chen,

Chen Ni <nichen@iscas.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@piap.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

      parent reply	other threads:[~2026-02-06  6:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30  4:18 [PATCH] media: i2c: ar0521: Check return value of devm_gpiod_get_optional() in ar0521_probe() Chen Ni
2026-01-31  6:24 ` Markus Elfring
2026-02-06  6:39 ` Krzysztof Hałasa [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m35x8aidff.fsf@t19.piap.pl \
    --to=khalasa@piap.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nichen@iscas.ac.cn \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox