All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: drop explicit NULL comparisons
@ 2026-08-12  6:06 Kai Kuang
  2026-08-12 16:24 ` Andrew Lunn
  2026-08-12 18:40 ` Joe Damato
  0 siblings, 2 replies; 3+ messages in thread
From: Kai Kuang @ 2026-08-12  6:06 UTC (permalink / raw)
  To: netdev; +Cc: andrew, olteanv, f.fainelli, linux-kernel, kk47yx, Kai Kuang

Replace explicit NULL comparisons with the boolean form to follow
the kernel coding style:

  dev->class != NULL  -> dev->class
  user_dev == NULL    -> !user_dev

No functional changes intended.

Signed-off-by: Kai Kuang <kuangkai@kylinos.cn>
---
 net/dsa/dsa.c  | 2 +-
 net/dsa/user.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 9cb732f6b1e3..d72d7a49e113 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -1382,7 +1382,7 @@ static int dsa_switch_parse_of(struct dsa_switch *ds, struct device_node *dn)
 
 static int dev_is_class(struct device *dev, const void *class)
 {
-	if (dev->class != NULL && !strcmp(dev->class->name, class))
+	if (dev->class && !strcmp(dev->class->name, class))
 		return 1;
 
 	return 0;
diff --git a/net/dsa/user.c b/net/dsa/user.c
index 072fa76972cc..7d65bb307c91 100644
--- a/net/dsa/user.c
+++ b/net/dsa/user.c
@@ -2779,7 +2779,7 @@ int dsa_user_create(struct dsa_port *port)
 	user_dev = alloc_netdev_mqs(sizeof(struct dsa_user_priv), name,
 				    assign_type, ether_setup,
 				    ds->num_tx_queues, 1);
-	if (user_dev == NULL)
+	if (!user_dev)
 		return -ENOMEM;
 
 	user_dev->rtnl_link_ops = &dsa_link_ops;
-- 
2.25.1


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

end of thread, other threads:[~2026-08-12 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12  6:06 [PATCH net-next] net: dsa: drop explicit NULL comparisons Kai Kuang
2026-08-12 16:24 ` Andrew Lunn
2026-08-12 18:40 ` Joe Damato

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.