From: Christophe Ricard Date: Mon, 28 Jul 2014 16:11:36 +0000 (+0200) Subject: NFC: st21nfcb: Remove inappropriate kfree on a previously devm_kzalloc pointer X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=df2566fe37d92dfba032e6084ebfb708dac5dc9a;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Signed-off-by: Samuel Ortiz --- 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, phy_headroom, phy_tailroom); if (!ndlc->ndev) { pr_err("Cannot allocate nfc ndev\n"); - r = -ENOMEM; - goto err_alloc_ndev; + return -ENOMEM; } info->ndlc = ndlc; nci_set_drvdata(ndlc->ndev, info); r = nci_register_device(ndlc->ndev); - if (r) - goto err_regdev; - - return r; -err_regdev: - nci_free_device(ndlc->ndev); + if (r) { + pr_err("Cannot register nfc device to nci core\n"); + nci_free_device(ndlc->ndev); + } -err_alloc_ndev: - kfree(info); return r; } EXPORT_SYMBOL_GPL(st21nfcb_nci_probe);