[PATCH 1/5] hamradio: mkiss: move assignments out of if conditions

Mashiro Chen posted 5 patches 3 days, 20 hours ago
[PATCH 1/5] hamradio: mkiss: move assignments out of if conditions
Posted by Mashiro Chen 3 days, 20 hours ago
Move assignments out of if conditions to comply with
the Linux Kernel coding style and improve code
readability. This also switches to the preferred
'if (!ptr)' idiom for NULL pointer checks.

Signed-off-by: Mashiro Chen <mashiro.chen@mailbox.org>
---
 drivers/net/hamradio/mkiss.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index 5f38a002b..eac45d936 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -282,7 +282,8 @@ static void ax_bump(struct mkiss *ax)
 
 	count = ax->rcount;
 
-	if ((skb = dev_alloc_skb(count)) == NULL) {
+	skb = dev_alloc_skb(count);
+	if (!skb) {
 		printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
 		       ax->dev->name);
 		ax->dev->stats.rx_dropped++;
@@ -591,10 +592,12 @@ static int ax_open(struct net_device *dev)
 	if (len < 576 * 2)
 		len = 576 * 2;
 
-	if ((ax->rbuff = kmalloc(len + 4, GFP_KERNEL)) == NULL)
+	ax->rbuff = kmalloc(len + 4, GFP_KERNEL);
+	if (!ax->rbuff)
 		goto norbuff;
 
-	if ((ax->xbuff = kmalloc(len + 4, GFP_KERNEL)) == NULL)
+	ax->xbuff = kmalloc(len + 4, GFP_KERNEL);
+	if (!ax->xbuff)
 		goto noxbuff;
 
 	ax->mtu	     = dev->mtu + 73;
-- 
2.53.0