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 <amsfield22@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e3b07865f5
commit
27f31cf9f7
|
@ -431,7 +431,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
|
||||||
for (ii = 0; ii < priv->num_tx_context; ii++) {
|
for (ii = 0; ii < priv->num_tx_context; ii++) {
|
||||||
tx_context = kmalloc(sizeof(struct vnt_usb_send_context),
|
tx_context = kmalloc(sizeof(struct vnt_usb_send_context),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (tx_context == NULL)
|
if (!tx_context)
|
||||||
goto free_tx;
|
goto free_tx;
|
||||||
|
|
||||||
priv->tx_context[ii] = tx_context;
|
priv->tx_context[ii] = tx_context;
|
||||||
|
@ -462,13 +462,13 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
|
||||||
|
|
||||||
/* allocate URBs */
|
/* allocate URBs */
|
||||||
rcb->urb = usb_alloc_urb(0, GFP_ATOMIC);
|
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");
|
dev_err(&priv->usb->dev, "Failed to alloc rx urb\n");
|
||||||
goto free_rx_tx;
|
goto free_rx_tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
rcb->skb = dev_alloc_skb(priv->rx_buf_sz);
|
rcb->skb = dev_alloc_skb(priv->rx_buf_sz);
|
||||||
if (rcb->skb == NULL)
|
if (!rcb->skb)
|
||||||
goto free_rx_tx;
|
goto free_rx_tx;
|
||||||
|
|
||||||
rcb->in_use = false;
|
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);
|
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");
|
dev_err(&priv->usb->dev, "Failed to alloc int urb\n");
|
||||||
goto free_rx_tx;
|
goto free_rx_tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->int_buf.data_buf = kmalloc(MAX_INTERRUPT_SIZE, GFP_KERNEL);
|
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);
|
usb_free_urb(priv->interrupt_urb);
|
||||||
goto free_rx_tx;
|
goto free_rx_tx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,7 +210,7 @@ int vnt_submit_rx_urb(struct vnt_private *priv, struct vnt_rcb *rcb)
|
||||||
struct urb *urb;
|
struct urb *urb;
|
||||||
|
|
||||||
urb = rcb->urb;
|
urb = rcb->urb;
|
||||||
if (rcb->skb == NULL) {
|
if (!rcb->skb) {
|
||||||
dev_dbg(&priv->usb->dev, "rcb->skb is null\n");
|
dev_dbg(&priv->usb->dev, "rcb->skb is null\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue