[PATCH] NFC: st95hf: remove unnecessary assignment and label

Subsystems: nfc subsystem, the rest

STALE1900d

2 messages, 2 authors, 2021-05-25 · open the first message on its own page

[PATCH] NFC: st95hf: remove unnecessary assignment and label

From: samirweng1979 <hidden>
Date: 2021-05-25 06:38:29

From: wengjianfeng <redacted>

In function st95hf_in_send_cmd, the variable rc is assigned then goto
error label, which just return rc, so we use return to replace it. and
error label only used once in the function, so we remove error label.

Signed-off-by: wengjianfeng <redacted>
---
 drivers/nfc/st95hf/core.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index 4578547..88924be 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -926,10 +926,8 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev,
 	int len_data_to_tag = 0;
 
 	skb_resp = nfc_alloc_recv_skb(MAX_RESPONSE_BUFFER_SIZE, GFP_KERNEL);
-	if (!skb_resp) {
-		rc = -ENOMEM;
-		goto error;
-	}
+	if (!skb_resp)
+		return -ENOMEM;
 
 	switch (stcontext->current_rf_tech) {
 	case NFC_DIGITAL_RF_TECH_106A:
@@ -986,7 +984,6 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev,
 
 free_skb_resp:
 	kfree_skb(skb_resp);
-error:
 	return rc;
 }
 
-- 
1.9.1

Re: [PATCH] NFC: st95hf: remove unnecessary assignment and label

From: Krzysztof Kozlowski <hidden>
Date: 2021-05-25 11:38:24

On 25/05/2021 02:38, samirweng1979 wrote:
From: wengjianfeng <redacted>

In function st95hf_in_send_cmd, the variable rc is assigned then goto
error label, which just return rc, so we use return to replace it. and
s/return/returns/
s/. and/. Since/ (don't start sentences with "and", neither with
lowercase letter).
error label only used once in the function, so we remove error label.
With these fixes and subject prefix fix to "nfc" (lowercase):

Reviewed-by: Krzysztof Kozlowski <redacted>

Best regards,
Krzysztof
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help