Re: [PATCH 1/2] i2c: slave: improve sanity check when registering

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

 



Hi Wolfram,

Reviewed-by: Alain Volmat <alain.volmat@xxxxxx>

Alain

On Sat, Jul 25, 2020 at 09:50:52PM +0200, Wolfram Sang wrote:
> Add check for ERR_PTR and simplify code while here.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/i2c/i2c-core-slave.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core-slave.c b/drivers/i2c/i2c-core-slave.c
> index 5427f047faf0..549751347e6c 100644
> --- a/drivers/i2c/i2c-core-slave.c
> +++ b/drivers/i2c/i2c-core-slave.c
> @@ -18,10 +18,8 @@ int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb)
>  {
>  	int ret;
>  
> -	if (!client || !slave_cb) {
> -		WARN(1, "insufficient data\n");
> +	if (WARN(IS_ERR_OR_NULL(client) || !slave_cb, "insufficient data\n"))
>  		return -EINVAL;
> -	}
>  
>  	if (!(client->flags & I2C_CLIENT_SLAVE))
>  		dev_warn(&client->dev, "%s: client slave flag not set. You might see address collisions\n",
> -- 
> 2.20.1
> 



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux