mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH master] i2c: don't return error pointers from of_find_i2c_adapter_by_node
Date: Sat, 17 Feb 2024 00:05:34 +0100	[thread overview]
Message-ID: <20240216230534.pyw6igylfkpoqmoj@pengutronix.de> (raw)
In-Reply-To: <20240216220337.2327115-1-a.fatoum@pengutronix.de>

On 24-02-16, Ahmad Fatoum wrote:
> All callers of of_find_i2c_adapter_by_node expect errors to be indicated
> by NULL and don't check non-NULL pointers with IS_ERR().

Good catch.

> Therefore map of_device_ensure_probed() errors to NULL as well to avoid
> dereferencing error pointers.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>

> ---
>  drivers/i2c/i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
> index 70d1b810c1c3..1985ddfdc776 100644
> --- a/drivers/i2c/i2c.c
> +++ b/drivers/i2c/i2c.c
> @@ -593,7 +593,7 @@ struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
>  
>  	ret = of_device_ensure_probed(node);
>  	if (ret)
> -		return ERR_PTR(ret);
> +		return NULL;
>  
>  	for_each_i2c_adapter(adap)
>  		if (adap->dev.of_node == node)
> -- 
> 2.39.2
> 
> 
> 



  reply	other threads:[~2024-02-16 23:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 22:03 Ahmad Fatoum
2024-02-16 23:05 ` Marco Felsch [this message]
2024-02-19  8:01 ` Sascha Hauer

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=20240216230534.pyw6igylfkpoqmoj@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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