[PATCH 3/3] char/pcmcia: Adjust a null pointer check in three functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 16 Oct 2017 13:46:00 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written !…

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
 drivers/char/pcmcia/synclink_cs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 6c210b5cdf69..1719d929c0e4 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -2644,7 +2644,7 @@ static int rx_alloc_buffers(MGSLPC_INFO *info)
 	info->rx_buf_count = info->rx_buf_total_size / info->rx_buf_size;
 
 	info->rx_buf = kmalloc(info->rx_buf_total_size, GFP_KERNEL);
-	if (info->rx_buf == NULL)
+	if (!info->rx_buf)
 		return -ENOMEM;
 
 	/* unused flag buffer to satisfy receive_buf calling interface */
@@ -4228,7 +4228,7 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size)
 	if (debug_level >= DEBUG_LEVEL_INFO)
 		printk("hdlcdev_rx(%s)\n", dev->name);
 
-	if (skb == NULL) {
+	if (!skb) {
 		printk(KERN_NOTICE "%s: can't alloc skb, dropping packet\n", dev->name);
 		dev->stats.rx_dropped++;
 		return;
@@ -4269,7 +4269,7 @@ static int hdlcdev_init(MGSLPC_INFO *info)
 	/* allocate and initialize network and HDLC layer objects */
 
 	dev = alloc_hdlcdev(info);
-	if (dev == NULL) {
+	if (!dev) {
 		printk(KERN_ERR "%s:hdlc device allocation failure\n", __FILE__);
 		return -ENOMEM;
 	}
-- 
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux