aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/nfc/nfcmrvl/main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c
index 5f91d4571429..85e8bcf98693 100644
--- a/drivers/nfc/nfcmrvl/main.c
+++ b/drivers/nfc/nfcmrvl/main.c
@@ -112,7 +112,8 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
112 priv->ndev = nci_allocate_device(&nfcmrvl_nci_ops, protocols, 0, 0); 112 priv->ndev = nci_allocate_device(&nfcmrvl_nci_ops, protocols, 0, 0);
113 if (!priv->ndev) { 113 if (!priv->ndev) {
114 nfc_err(dev, "nci_allocate_device failed"); 114 nfc_err(dev, "nci_allocate_device failed");
115 return ERR_PTR(-ENOMEM); 115 rc = -ENOMEM;
116 goto error;
116 } 117 }
117 118
118 nci_set_drvdata(priv->ndev, priv); 119 nci_set_drvdata(priv->ndev, priv);
@@ -121,11 +122,15 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(void *drv_data,
121 if (rc) { 122 if (rc) {
122 nfc_err(dev, "nci_register_device failed %d", rc); 123 nfc_err(dev, "nci_register_device failed %d", rc);
123 nci_free_device(priv->ndev); 124 nci_free_device(priv->ndev);
124 return ERR_PTR(rc); 125 goto error;
125 } 126 }
126 127
127 nfc_info(dev, "registered with nci successfully\n"); 128 nfc_info(dev, "registered with nci successfully\n");
128 return priv; 129 return priv;
130
131error:
132 kfree(priv);
133 return ERR_PTR(rc);
129} 134}
130EXPORT_SYMBOL_GPL(nfcmrvl_nci_register_dev); 135EXPORT_SYMBOL_GPL(nfcmrvl_nci_register_dev);
131 136