Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1238511

Re: [PATCH 03/18] Input: cyttsp - use PTR_ERR_OR_ZERO()

From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 03/18] Input: cyttsp - use PTR_ERR_OR_ZERO()
Date 2015-10-02 20:30 +0200
Message-ID <qfdfH-2Wl-11@gated-at.bofh.it> (permalink)
References <qf8SJ-4YE-7@gated-at.bofh.it> <qf8SK-4YE-47@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Oct 02, 2015 at 03:40:14PM +0200, Javier Martinez Canillas wrote:
> The PTR_ERR_OR_ZERO() helper function checks if a pointer contains an
> errno code and returns it or return 0 if that's not the case. Use the
> helper instead of open coding the same logic in the driver. This was
> found with make coccicheck that complains with the following warning:
> 
> drivers/input/touchscreen/cyttsp4_i2c.c:53:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

Applied, thank you.

> ---
> 
>  drivers/input/touchscreen/cyttsp4_i2c.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/cyttsp4_i2c.c b/drivers/input/touchscreen/cyttsp4_i2c.c
> index a9f95c7d3c00..564e49002d5d 100644
> --- a/drivers/input/touchscreen/cyttsp4_i2c.c
> +++ b/drivers/input/touchscreen/cyttsp4_i2c.c
> @@ -50,10 +50,7 @@ static int cyttsp4_i2c_probe(struct i2c_client *client,
>  	ts = cyttsp4_probe(&cyttsp4_i2c_bus_ops, &client->dev, client->irq,
>  			  CYTTSP4_I2C_DATA_SIZE);
>  
> -	if (IS_ERR(ts))
> -		return PTR_ERR(ts);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(ts);
>  }
>  
>  static int cyttsp4_i2c_remove(struct i2c_client *client)
> -- 
> 2.4.3
> 

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 03/18] Input: cyttsp - use PTR_ERR_OR_ZERO() Javier Martinez Canillas <javier@osg.samsung.com> - 2015-10-02 15:50 +0200
  Re: [PATCH 03/18] Input: cyttsp - use PTR_ERR_OR_ZERO() Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-10-02 20:30 +0200

csiph-web