Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df2566fe authored by Christophe Ricard's avatar Christophe Ricard Committed by Samuel Ortiz
Browse files

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: default avatarChristophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 2c376a9e
Loading
Loading
Loading
Loading
+5 −10
Original line number Original line Diff line number Diff line
@@ -94,23 +94,18 @@ int st21nfcb_nci_probe(struct llt_ndlc *ndlc, int phy_headroom,
					phy_headroom, phy_tailroom);
					phy_headroom, phy_tailroom);
	if (!ndlc->ndev) {
	if (!ndlc->ndev) {
		pr_err("Cannot allocate nfc ndev\n");
		pr_err("Cannot allocate nfc ndev\n");
		r = -ENOMEM;
		return -ENOMEM;
		goto err_alloc_ndev;
	}
	}
	info->ndlc = ndlc;
	info->ndlc = ndlc;


	nci_set_drvdata(ndlc->ndev, info);
	nci_set_drvdata(ndlc->ndev, info);


	r = nci_register_device(ndlc->ndev);
	r = nci_register_device(ndlc->ndev);
	if (r)
	if (r) {
		goto err_regdev;
		pr_err("Cannot register nfc device to nci core\n");

	return r;
err_regdev:
		nci_free_device(ndlc->ndev);
		nci_free_device(ndlc->ndev);
	}


err_alloc_ndev:
	kfree(info);
	return r;
	return r;
}
}
EXPORT_SYMBOL_GPL(st21nfcb_nci_probe);
EXPORT_SYMBOL_GPL(st21nfcb_nci_probe);