mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] wifi: mt76: mt7921: fix missing unwind goto in `mt7921u_probe`
@ 2023-04-12  6:22 Jiefeng Li
  2023-04-12 14:12 ` Samudrala, Sridhar
  0 siblings, 1 reply; 2+ messages in thread
From: Jiefeng Li @ 2023-04-12  6:22 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi, Ryder Lee, Shayne Chen,
	Sean Wang, Kalle Valo, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: Jiefeng Li, Dongliang Mu, linux-wireless, netdev, linux-kernel,
	linux-arm-kernel, linux-mediatek

`mt7921u_dma_init` can only return zero or negative number according to its
definition. When it returns non-zero number, there exists an error and this
function should handle this error rather than return directly.

Fixes: 0d2afe09fad5 ("mt76: mt7921: add mt7921u driver")
Signed-off-by: Jiefeng Li <jiefeng_li@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
---
The issue is discovered by static analysis, and the patch is not tested yet.
---
 drivers/net/wireless/mediatek/mt76/mt7921/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c
index 8fef09ed29c9..70c9bbdbf60e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c
@@ -272,7 +272,7 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
 
 	ret = mt7921u_dma_init(dev, false);
 	if (ret)
-		return ret;
+		goto error;
 
 	hw = mt76_hw(dev);
 	/* check hw sg support in order to enable AMSDU */
-- 
2.34.1


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

* Re: [PATCH] wifi: mt76: mt7921: fix missing unwind goto in `mt7921u_probe`
  2023-04-12  6:22 [PATCH] wifi: mt76: mt7921: fix missing unwind goto in `mt7921u_probe` Jiefeng Li
@ 2023-04-12 14:12 ` Samudrala, Sridhar
  0 siblings, 0 replies; 2+ messages in thread
From: Samudrala, Sridhar @ 2023-04-12 14:12 UTC (permalink / raw)
  To: Jiefeng Li, Felix Fietkau, Lorenzo Bianconi, Ryder Lee,
	Shayne Chen, Sean Wang, Kalle Valo, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: Dongliang Mu, linux-wireless, netdev, linux-kernel,
	linux-arm-kernel, linux-mediatek



On 4/12/2023 1:22 AM, Jiefeng Li wrote:
> `mt7921u_dma_init` can only return zero or negative number according to its
> definition. When it returns non-zero number, there exists an error and this
> function should handle this error rather than return directly.
> 
> Fixes: 0d2afe09fad5 ("mt76: mt7921: add mt7921u driver")
> Signed-off-by: Jiefeng Li <jiefeng_li@hust.edu.cn>
> Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>

Reviewed-by: Sridhar Samudrala <sridhar.samudrala@intel.com>

> ---
> The issue is discovered by static analysis, and the patch is not tested yet.
> ---
>   drivers/net/wireless/mediatek/mt76/mt7921/usb.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c
> index 8fef09ed29c9..70c9bbdbf60e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/usb.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/usb.c
> @@ -272,7 +272,7 @@ static int mt7921u_probe(struct usb_interface *usb_intf,
>   
>   	ret = mt7921u_dma_init(dev, false);
>   	if (ret)
> -		return ret;
> +		goto error;
>   
>   	hw = mt76_hw(dev);
>   	/* check hw sg support in order to enable AMSDU */

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

end of thread, other threads:[~2023-04-12 14:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-12  6:22 [PATCH] wifi: mt76: mt7921: fix missing unwind goto in `mt7921u_probe` Jiefeng Li
2023-04-12 14:12 ` Samudrala, Sridhar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®