Re: [PATCH master] i2c: don't return error pointers from of_find_i2c_adapter_by_node

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>

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

> ---
>  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
> 
> 
> 




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux