Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1238512
| From | Dmitry Torokhov <dmitry.torokhov@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 02/18] Input: ads7846 - use PTR_ERR_OR_ZERO() |
| Date | 2015-10-02 20:30 +0200 |
| Message-ID | <qfdfI-2Wl-15@gated-at.bofh.it> (permalink) |
| References | <qf8SJ-4YE-7@gated-at.bofh.it> <qf8SM-4YE-79@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Oct 02, 2015 at 03:40:13PM +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/ads7846.c:532: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/ads7846.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c > index 0f5f968592bd..727d88c900c1 100644 > --- a/drivers/input/touchscreen/ads7846.c > +++ b/drivers/input/touchscreen/ads7846.c > @@ -529,10 +529,8 @@ static int ads784x_hwmon_register(struct spi_device *spi, struct ads7846 *ts) > > ts->hwmon = hwmon_device_register_with_groups(&spi->dev, spi->modalias, > ts, ads7846_attr_groups); > - if (IS_ERR(ts->hwmon)) > - return PTR_ERR(ts->hwmon); > > - return 0; > + return PTR_ERR_OR_ZERO(ts->hwmon); > } > > static void ads784x_hwmon_unregister(struct spi_device *spi, > -- > 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 | Next — Previous in thread | Find similar | Unroll thread
[PATCH 02/18] Input: ads7846 - use PTR_ERR_OR_ZERO() Javier Martinez Canillas <javier@osg.samsung.com> - 2015-10-02 15:50 +0200 Re: [PATCH 02/18] Input: ads7846 - use PTR_ERR_OR_ZERO() Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-10-02 20:30 +0200
csiph-web