Commit 27f31cf9 authored by Alison Schofield's avatar Alison Schofield Committed by Greg Kroah-Hartman
Browse files

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: default avatarAlison Schofield <amsfield22@gmail.com>
Acked-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e3b07865
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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;
	}
+1 −1
Original line number Diff line number Diff line
@@ -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;
	}