aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2014-07-28 12:11:36 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2014-09-07 17:56:48 -0400
commitdf2566fe37d92dfba032e6084ebfb708dac5dc9a (patch)
treeb8c4f3e6705a2576aeb1fcc9a0136e02f4975cd0 /drivers/nfc
parent2c376a9e3c973e7923daba78aa16c768503cdef3 (diff)
NFC: st21nfcb: Remove inappropriate kfree on a previously devm_kzalloc pointer
In case of an error during driver probe, info pointer was freed with kfree. No need to free anything when using devm_kzalloc. Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/st21nfcb/st21nfcb.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/nfc/st21nfcb/st21nfcb.c b/drivers/nfc/st21nfcb/st21nfcb.c
index 4d95863e3063..64d2eaf40ef8 100644
--- a/drivers/nfc/st21nfcb/st21nfcb.c
+++ b/drivers/nfc/st21nfcb/st21nfcb.c
@@ -94,23 +94,18 @@ int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int phy_headroom,
94 phy_headroom, phy_tailroom); 94 phy_headroom, phy_tailroom);
95 if (!ndlc->ndev) { 95 if (!ndlc->ndev) {
96 pr_err("Cannot allocate nfc ndev\n"); 96 pr_err("Cannot allocate nfc ndev\n");
97 r = -ENOMEM; 97 return -ENOMEM;
98 goto err_alloc_ndev;
99 } 98 }
100 info->ndlc = ndlc; 99 info->ndlc = ndlc;
101 100
102 nci_set_drvdata(ndlc->ndev, info); 101 nci_set_drvdata(ndlc->ndev, info);
103 102
104 r = nci_register_device(ndlc->ndev); 103 r = nci_register_device(ndlc->ndev);
105 if (r) 104 if (r) {
106 goto err_regdev; 105 pr_err("Cannot register nfc device to nci core\n");
107 106 nci_free_device(ndlc->ndev);
108 return r; 107 }
109err_regdev:
110 nci_free_device(ndlc->ndev);
111 108
112err_alloc_ndev:
113 kfree(info);
114 return r; 109 return r;
115} 110}
116EXPORT_SYMBOL_GPL(st21nfcb_nci_probe); 111EXPORT_SYMBOL_GPL(st21nfcb_nci_probe);