All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH wireless v3 -next] brcmfmac: Delete useless kfree code
@ 2020-12-22 13:51 Zheng Yongjun
  2021-01-14 17:32 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Zheng Yongjun @ 2020-12-22 13:51 UTC (permalink / raw)
  To: kvalo, davem, kuba, linux-wireless, brcm80211-dev-list.pdl,
	SHA-cyfmac-dev-list, netdev, linux-kernel, Markus.Elfring
  Cc: Zheng Yongjun

A null pointer will be passed to a kfree() call after a kzalloc() call failed.
This code is useless. Thus delete the extra function call.

A goto statement is also no longer needed. Thus adjust an if branch.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 .../wireless/broadcom/brcm80211/brcmfmac/firmware.c    | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
index d821a4758f8c..d40104b8df55 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
@@ -319,8 +319,10 @@ static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
 	u8 *nvram;
 
 	nvram = kzalloc(nvp->nvram_len + 1 + 3 + sizeof(u32), GFP_KERNEL);
-	if (!nvram)
-		goto fail;
+	if (!nvram) {
+		nvp->nvram_len = 0;
+		return;
+	}
 
 	/* Copy all valid entries, release old nvram and assign new one.
 	 * Valid entries are of type pcie/X/Y/ where X = domain_nr and
@@ -350,10 +352,6 @@ static void brcmf_fw_strip_multi_v2(struct nvram_parser *nvp, u16 domain_nr,
 	kfree(nvp->nvram);
 	nvp->nvram = nvram;
 	nvp->nvram_len = j;
-	return;
-fail:
-	kfree(nvram);
-	nvp->nvram_len = 0;
 }
 
 static void brcmf_fw_add_defaults(struct nvram_parser *nvp)
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH wireless v3 -next] brcmfmac: Delete useless kfree code
  2020-12-22 13:51 [PATCH wireless v3 -next] brcmfmac: Delete useless kfree code Zheng Yongjun
@ 2021-01-14 17:32 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2021-01-14 17:32 UTC (permalink / raw)
  To: Zheng Yongjun
  Cc: davem, kuba, linux-wireless, brcm80211-dev-list.pdl,
	SHA-cyfmac-dev-list, netdev, linux-kernel, Markus.Elfring,
	Zheng Yongjun

Zheng Yongjun <zhengyongjun3@huawei.com> wrote:

> A null pointer will be passed to a kfree() call after a kzalloc() call failed.
> This code is useless. Thus delete the extra function call.
> 
> A goto statement is also no longer needed. Thus adjust an if branch.
> 
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>

Patch applied to wireless-drivers-next.git, thanks.

73c655410181 brcmfmac: Delete useless kfree code

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20201222135113.20680-1-zhengyongjun3@huawei.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-14 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22 13:51 [PATCH wireless v3 -next] brcmfmac: Delete useless kfree code Zheng Yongjun
2021-01-14 17:32 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.