staging: vt6656: replace explicit NULL comparison with ! operator
authorAlison Schofield <amsfield22@gmail.com>
Thu, 11 Feb 2016 07:06:45 +0000 (23:06 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 12 Feb 2016 04:00:30 +0000 (20:00 -0800)
Replace explicit NULL comparison with ! operator to simplify code.

Found with Coccinelle:
@@
expression e;
statement s0, s1;
@@

if (
(
+ !
e
- == NULL
 || ...
)
 ) s0 else s1

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/main_usb.c
drivers/staging/vt6656/usbpipe.c

index a2f23aefb35dcd3246230283612d1daff35744c4..05f86ff8875c9b2f67fe465e4c8715ab7b2c6f85 100644 (file)
@@ -431,7 +431,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
        for (ii = 0; ii < priv->num_tx_context; ii++) {
                tx_context = kmalloc(sizeof(struct vnt_usb_send_context),
                                                                GFP_KERNEL);
-               if (tx_context == NULL)
+               if (!tx_context)
                        goto free_tx;
 
                priv->tx_context[ii] = tx_context;
@@ -462,13 +462,13 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
 
                /* allocate URBs */
                rcb->urb = usb_alloc_urb(0, GFP_ATOMIC);
-               if (rcb->urb == NULL) {
+               if (!rcb->urb) {
                        dev_err(&priv->usb->dev, "Failed to alloc rx urb\n");
                        goto free_rx_tx;
                }
 
                rcb->skb = dev_alloc_skb(priv->rx_buf_sz);
-               if (rcb->skb == NULL)
+               if (!rcb->skb)
                        goto free_rx_tx;
 
                rcb->in_use = false;
@@ -479,13 +479,13 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
        }
 
        priv->interrupt_urb = usb_alloc_urb(0, GFP_ATOMIC);
-       if (priv->interrupt_urb == NULL) {
+       if (!priv->interrupt_urb) {
                dev_err(&priv->usb->dev, "Failed to alloc int urb\n");
                goto free_rx_tx;
        }
 
        priv->int_buf.data_buf = kmalloc(MAX_INTERRUPT_SIZE, GFP_KERNEL);
-       if (priv->int_buf.data_buf == NULL) {
+       if (!priv->int_buf.data_buf) {
                usb_free_urb(priv->interrupt_urb);
                goto free_rx_tx;
        }
index 351a99f3d68410973ce14def165dd0a5358213c6..bec5bafaca3c00ce0b2106498690e0ef350a248d 100644 (file)
@@ -210,7 +210,7 @@ int vnt_submit_rx_urb(struct vnt_private *priv, struct vnt_rcb *rcb)
        struct urb *urb;
 
        urb = rcb->urb;
-       if (rcb->skb == NULL) {
+       if (!rcb->skb) {
                dev_dbg(&priv->usb->dev, "rcb->skb is null\n");
                return status;
        }