Linux-Wireless Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH net] qtnfmac: Missing platform_device_unregister() on error in qtnf_core_mac_alloc()
@ 2020-07-30  6:49 Wang Hai
  2020-07-30 10:20 ` Sergey Matyukevich
  2020-08-02 15:20 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Wang Hai @ 2020-07-30  6:49 UTC (permalink / raw)
  To: imitsyanko, geomatsi, kvalo, davem, kuba, mst, mkarpenko
  Cc: linux-wireless, netdev, linux-kernel

Add the missing platform_device_unregister() before return from
qtnf_core_mac_alloc() in the error handling case.

Fixes: 616f5701f4ab ("qtnfmac: assign each wiphy to its own virtual platform device")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
 drivers/net/wireless/quantenna/qtnfmac/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c
index eea777f8acea..6aafff9d4231 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/core.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/core.c
@@ -446,8 +446,11 @@ static struct qtnf_wmac *qtnf_core_mac_alloc(struct qtnf_bus *bus,
 	}
 
 	wiphy = qtnf_wiphy_allocate(bus, pdev);
-	if (!wiphy)
+	if (!wiphy) {
+		if (pdev)
+			platform_device_unregister(pdev);
 		return ERR_PTR(-ENOMEM);
+	}
 
 	mac = wiphy_priv(wiphy);
 
-- 
2.17.1


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

* Re: [PATCH net] qtnfmac: Missing platform_device_unregister() on error in qtnf_core_mac_alloc()
  2020-07-30  6:49 [PATCH net] qtnfmac: Missing platform_device_unregister() on error in qtnf_core_mac_alloc() Wang Hai
@ 2020-07-30 10:20 ` Sergey Matyukevich
  2020-08-02 15:20 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Sergey Matyukevich @ 2020-07-30 10:20 UTC (permalink / raw)
  To: Wang Hai
  Cc: imitsyanko, kvalo, davem, kuba, mst, mkarpenko, linux-wireless,
	netdev, linux-kernel

> Add the missing platform_device_unregister() before return from
> qtnf_core_mac_alloc() in the error handling case.
> 
> Fixes: 616f5701f4ab ("qtnfmac: assign each wiphy to its own virtual platform device")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>
> ---
>  drivers/net/wireless/quantenna/qtnfmac/core.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c
> index eea777f8acea..6aafff9d4231 100644
> --- a/drivers/net/wireless/quantenna/qtnfmac/core.c
> +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c
> @@ -446,8 +446,11 @@ static struct qtnf_wmac *qtnf_core_mac_alloc(struct qtnf_bus *bus,
>  	}
>  
>  	wiphy = qtnf_wiphy_allocate(bus, pdev);
> -	if (!wiphy)
> +	if (!wiphy) {
> +		if (pdev)
> +			platform_device_unregister(pdev);
>  		return ERR_PTR(-ENOMEM);
> +	}
>  
>  	mac = wiphy_priv(wiphy);

Reviewed-by: Sergey Matyukevich <geomatsi@gmail.com>

Thanks,
Sergey

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

* Re: [PATCH net] qtnfmac: Missing platform_device_unregister() on error in qtnf_core_mac_alloc()
  2020-07-30  6:49 [PATCH net] qtnfmac: Missing platform_device_unregister() on error in qtnf_core_mac_alloc() Wang Hai
  2020-07-30 10:20 ` Sergey Matyukevich
@ 2020-08-02 15:20 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2020-08-02 15:20 UTC (permalink / raw)
  To: Wang Hai
  Cc: imitsyanko, geomatsi, davem, kuba, mst, mkarpenko,
	linux-wireless, netdev, linux-kernel

Wang Hai <wanghai38@huawei.com> wrote:

> Add the missing platform_device_unregister() before return from
> qtnf_core_mac_alloc() in the error handling case.
> 
> Fixes: 616f5701f4ab ("qtnfmac: assign each wiphy to its own virtual platform device")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>
> Reviewed-by: Sergey Matyukevich <geomatsi@gmail.com>

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

141bc9abbbff qtnfmac: Missing platform_device_unregister() on error in qtnf_core_mac_alloc()

-- 
https://patchwork.kernel.org/patch/11692387/

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


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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30  6:49 [PATCH net] qtnfmac: Missing platform_device_unregister() on error in qtnf_core_mac_alloc() Wang Hai
2020-07-30 10:20 ` Sergey Matyukevich
2020-08-02 15:20 ` Kalle Valo

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org
	public-inbox-index linux-wireless

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git