All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: irda: drivers: Replace (skb == NULL) with (!skb)
@ 2017-09-15  9:13 Meghana Madhyastha
  2017-09-15 10:42 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Meghana Madhyastha @ 2017-09-15  9:13 UTC (permalink / raw)
  To: outreachy-kernel

Some functions return NULL as an indication of failure.
The style (!skb) is more common than (skb == NULL) for these
functions.

Found by the following Coccinelle script.

@@
identifier i;
statement S;
@@

i = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\|usb_alloc_urb\|
alloc_netdev\|dev_alloc_skb\)(...));

(
-if (i == NULL)
+if (!i)
S
|
-if (NULL == i)
+if (!i)
S
)

Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com>
---
 drivers/staging/irda/drivers/ali-ircc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/irda/drivers/ali-ircc.c b/drivers/staging/irda/drivers/ali-ircc.c
index 35f198d..756ae53 100644
--- a/drivers/staging/irda/drivers/ali-ircc.c
+++ b/drivers/staging/irda/drivers/ali-ircc.c
@@ -1876,7 +1876,7 @@ static int  ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
 			self->stamp = ktime_get();
 
 			skb = dev_alloc_skb(len+1);
-			if (skb == NULL)  
+			if (!skb)
 			{
 				self->netdev->stats.rx_dropped++;
 
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-18  9:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-15  9:13 [PATCH] Staging: irda: drivers: Replace (skb == NULL) with (!skb) Meghana Madhyastha
2017-09-15 10:42 ` [Outreachy kernel] " Julia Lawall
2017-09-18  9:48   ` Greg KH
2017-09-18  9:48     ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.