net: dsa: drop explicit NULL comparisons

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>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Joe Damato <joe@dama.to>
Link: https://patch.msgid.link/20260812060644.210997-1-kuangkai@kylinos.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Kai Kuang
2026-08-12 14:06:44 +08:00
committed by Jakub Kicinski
parent 9958e69b98
commit e6a5d573d2
2 changed files with 2 additions and 2 deletions

View File

@@ -1383,7 +1383,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;

View File

@@ -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;