The nci_spi_send() function calls kfree_skb(skb) on both error and
success so this extra kfree_skb() is a double free.

Fixes: caf6e49bf6d0 ("NFC: nfcmrvl: add spi driver")
Signed-off-by: Dan Carpenter <[email protected]>
---
Static analysis.  Not tested.

diff --git a/drivers/nfc/nfcmrvl/spi.c b/drivers/nfc/nfcmrvl/spi.c
index a7faa0bcc01e..fc8e78a29d77 100644
--- a/drivers/nfc/nfcmrvl/spi.c
+++ b/drivers/nfc/nfcmrvl/spi.c
@@ -96,10 +96,9 @@ static int nfcmrvl_spi_nci_send(struct nfcmrvl_private *priv,
        /* Send the SPI packet */
        err = nci_spi_send(drv_data->nci_spi, &drv_data->handshake_completion,
                           skb);
-       if (err != 0) {
+       if (err)
                nfc_err(priv->dev, "spi_send failed %d", err);
-               kfree_skb(skb);
-       }
+
        return err;
 }
 

Reply via email to