Skip to content

Commit 69a6539

Browse files
can: slcan: convert comparison to NULL into !val
All comparison to NULL could be written "!val", convert them to make checkpatch happy. Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent f07d9e3 commit 69a6539

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

drivers/net/can/slcan/slcan-core.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ static netdev_tx_t slc_xmit(struct sk_buff *skb, struct net_device *dev)
618618
netdev_warn(dev, "xmit: iface is down\n");
619619
goto out;
620620
}
621-
if (sl->tty == NULL) {
621+
if (!sl->tty) {
622622
spin_unlock(&sl->lock);
623623
goto out;
624624
}
@@ -707,7 +707,7 @@ static int slc_open(struct net_device *dev)
707707
unsigned char cmd[SLC_MTU];
708708
int err, s;
709709

710-
if (sl->tty == NULL)
710+
if (!sl->tty)
711711
return -ENODEV;
712712

713713
/* The baud rate is not set with the command
@@ -834,7 +834,7 @@ static void slc_sync(void)
834834

835835
for (i = 0; i < maxdev; i++) {
836836
dev = slcan_devs[i];
837-
if (dev == NULL)
837+
if (!dev)
838838
break;
839839

840840
sl = netdev_priv(dev);
@@ -854,9 +854,8 @@ static struct slcan *slc_alloc(void)
854854

855855
for (i = 0; i < maxdev; i++) {
856856
dev = slcan_devs[i];
857-
if (dev == NULL)
857+
if (!dev)
858858
break;
859-
860859
}
861860

862861
/* Sorry, too many, all slots in use */
@@ -902,7 +901,7 @@ static int slcan_open(struct tty_struct *tty)
902901
if (!capable(CAP_NET_ADMIN))
903902
return -EPERM;
904903

905-
if (tty->ops->write == NULL)
904+
if (!tty->ops->write)
906905
return -EOPNOTSUPP;
907906

908907
/* RTnetlink lock is misused here to serialize concurrent
@@ -924,7 +923,7 @@ static int slcan_open(struct tty_struct *tty)
924923
/* OK. Find a free SLCAN channel to use. */
925924
err = -ENFILE;
926925
sl = slc_alloc();
927-
if (sl == NULL)
926+
if (!sl)
928927
goto err_exit;
929928

930929
sl->tty = tty;
@@ -1071,7 +1070,7 @@ static void __exit slcan_exit(void)
10711070
unsigned long timeout = jiffies + HZ;
10721071
int busy = 0;
10731072

1074-
if (slcan_devs == NULL)
1073+
if (!slcan_devs)
10751074
return;
10761075

10771076
/* First of all: check for active disciplines and hangup them.

0 commit comments

Comments
 (0)