[PATCH 2/2] nfc: mei_phy: Use common code in mei_nfc_connect()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 27 Dec 2023 16:45:39 +0100

Use another label so that a kfree() call can be better reused
at the end of this function.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
 drivers/nfc/mei_phy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c
index 937f229f4646..9272564012b3 100644
--- a/drivers/nfc/mei_phy.c
+++ b/drivers/nfc/mei_phy.c
@@ -157,8 +157,8 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy)

 	reply = kzalloc(connect_resp_length, GFP_KERNEL);
 	if (!reply) {
-		kfree(cmd);
-		return -ENOMEM;
+		r = -ENOMEM;
+		goto free_cmd;
 	}

 	connect_resp = (struct mei_nfc_connect_resp *)reply->data;
@@ -197,6 +197,7 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy)

 err:
 	kfree(reply);
+free_cmd:
 	kfree(cmd);

 	return r;
--
2.43.0






[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux