Skip to contentSkip to conversation

gpio: remove explicit comparison with 0

PATCH In review Saiyam Doshi 2 participants 2 messages Sep 7, 2019 – Sep 11, 2019 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: remove explicit comparison with 0

No need to compare return value with 0. In case of non-zero return value, the if condition will be true.

This makes intent a bit more clear to the reader. "if (x) then", compared to "if (x is not zero) then".

---
 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib.c +1 -1
index edc1ea68db20..847cb0c522d0 100644
@@ -851,7 +851,7 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p)
 	}
 
 	ret = kfifo_put(&le->events, ge);
-	if (ret != 0)
+	if (ret)
 		wake_up_poll(&le->wait, EPOLLIN);
 
 	return IRQ_HANDLED;
Signature · 1 line
2.20.1
#1 lore raw
Quoted 7 lines · Saiyam Doshi

No need to compare return value with 0. In case of non-zero return value, the if condition will be true.

This makes intent a bit more clear to the reader. "if (x) then", compared to "if (x is not zero) then".

Patch applied.

Yours,
Linus Walleij