From: Alison Schofield Date: Thu, 11 Feb 2016 07:06:45 +0000 (-0800) Subject: staging: vt6656: replace explicit NULL comparison with ! operator X-Git-Tag: v5.15~14007^2~913 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27f31cf9f7235cb3aa10860bf4fde5df6893bf52;p=platform%2Fkernel%2Flinux-starfive.git staging: vt6656: replace explicit NULL comparison with ! operator 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 Acked-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index a2f23ae..05f86ff 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -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; } diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index 351a99f..bec5baf 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -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; }