public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Mashiro Chen <mashiro.chen@mailbox.org>
To: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-hams@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Mashiro Chen <mashiro.chen@mailbox.org>
Subject: [PATCH 1/5] hamradio: mkiss: move assignments out of if conditions
Date: Sun, 29 Mar 2026 22:34:04 +0800	[thread overview]
Message-ID: <20260329143408.747197-2-mashiro.chen@mailbox.org> (raw)
In-Reply-To: <20260329143408.747197-1-mashiro.chen@mailbox.org>

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


  reply	other threads:[~2026-03-29 14:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-29 14:34 [PATCH 0/5] hamradio: mkiss: modernize and clean up mkiss driver Mashiro Chen
2026-03-29 14:34 ` Mashiro Chen [this message]
2026-03-29 14:34 ` [PATCH 2/5] hamradio: mkiss: remove redundant static initialization to 0 Mashiro Chen
2026-03-29 14:34 ` [PATCH 3/5] hamradio: mkiss: fix spacing around assignment operator Mashiro Chen
2026-03-29 14:34 ` [PATCH 4/5] hamradio: mkiss: modernize logging with netdev and pr macros Mashiro Chen
2026-03-29 14:34 ` [PATCH 5/5] hamradio: mkiss: cleanup indentation and coding style Mashiro Chen
2026-03-29 17:35 ` [PATCH 0/5] hamradio: mkiss: modernize and clean up mkiss driver Jakub Kicinski
2026-03-29 19:19   ` Mashiro Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260329143408.747197-2-mashiro.chen@mailbox.org \
    --to=mashiro.chen@mailbox.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-hams@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox