LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] spi: gpio: fix warning PTR_ERR_OR_ZERO can be used
@ 2019-05-25  9:47 Hariprasad Kelam
  0 siblings, 0 replies; only message in thread
From: Hariprasad Kelam @ 2019-05-25  9:47 UTC (permalink / raw)
  To: Mark Brown, linux-spi, linux-kernel

fix below warning reported by coccicheck

./drivers/spi/spi-gpio.c:302:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
 drivers/spi/spi-gpio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 487ee55..8c5b98a 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -299,10 +299,8 @@ static int spi_gpio_request(struct device *dev, struct spi_gpio *spi_gpio)
 		return PTR_ERR(spi_gpio->miso);
 
 	spi_gpio->sck = devm_gpiod_get(dev, "sck", GPIOD_OUT_LOW);
-	if (IS_ERR(spi_gpio->sck))
-		return PTR_ERR(spi_gpio->sck);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(spi_gpio->sck);
 }
 
 #ifdef CONFIG_OF
-- 
2.7.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-05-25  9:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-25  9:47 [PATCH] spi: gpio: fix warning PTR_ERR_OR_ZERO can be used Hariprasad Kelam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).