All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: cxgb3: add missed destroy_workqueue in cxgb3 probe failure
@ 2020-07-17  6:21 Wang Hai
  2020-07-18  1:39 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Wang Hai @ 2020-07-17  6:21 UTC (permalink / raw)
  To: vishal, davem, kuba, jeff, divy; +Cc: netdev, linux-kernel, wanghai38

The driver forgets to call destroy_workqueue when cxgb3 probe fails.
Add the missed calls to fix it.

Fixes: 4d22de3e6cc4 ("Add support for the latest 1G/10G Chelsio adapter, T3.")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
index 42c6e9379882..060d42803240 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
@@ -3407,6 +3407,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 out_disable_device:
 	pci_disable_device(pdev);
 out:
+	destroy_workqueue(cxgb3_wq);
 	return err;
 }
 
-- 
2.17.1


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

* Re: [PATCH] net: cxgb3: add missed destroy_workqueue in cxgb3 probe failure
  2020-07-17  6:21 [PATCH] net: cxgb3: add missed destroy_workqueue in cxgb3 probe failure Wang Hai
@ 2020-07-18  1:39 ` David Miller
  2020-07-18  7:57   ` wanghai (M)
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2020-07-18  1:39 UTC (permalink / raw)
  To: wanghai38; +Cc: vishal, kuba, jeff, divy, netdev, linux-kernel

From: Wang Hai <wanghai38@huawei.com>
Date: Fri, 17 Jul 2020 14:21:17 +0800

> The driver forgets to call destroy_workqueue when cxgb3 probe fails.
> Add the missed calls to fix it.
> 
> Fixes: 4d22de3e6cc4 ("Add support for the latest 1G/10G Chelsio adapter, T3.")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>

You have to handle the case that the probing of one or more devices
fails yet one or more others succeed.

And you can't know in advance how this will play out.

This is why the workqueue is unconditionally created, and only destroyed
on module remove.

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

* Re: [PATCH] net: cxgb3: add missed destroy_workqueue in cxgb3 probe failure
  2020-07-18  1:39 ` David Miller
@ 2020-07-18  7:57   ` wanghai (M)
  0 siblings, 0 replies; 4+ messages in thread
From: wanghai (M) @ 2020-07-18  7:57 UTC (permalink / raw)
  To: David Miller; +Cc: vishal, kuba, jeff, divy, netdev, linux-kernel


在 2020/7/18 9:39, David Miller 写道:
> From: Wang Hai <wanghai38@huawei.com>
> Date: Fri, 17 Jul 2020 14:21:17 +0800
>
>> The driver forgets to call destroy_workqueue when cxgb3 probe fails.
>> Add the missed calls to fix it.
>>
>> Fixes: 4d22de3e6cc4 ("Add support for the latest 1G/10G Chelsio adapter, T3.")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Wang Hai <wanghai38@huawei.com>
> You have to handle the case that the probing of one or more devices
> fails yet one or more others succeed.
>
> And you can't know in advance how this will play out.
>
> This is why the workqueue is unconditionally created, and only destroyed
> on module remove.
>
> .
Thanks for your explanation. I got it.


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

* Re: [PATCH] net: cxgb3: add missed destroy_workqueue in cxgb3 probe failure
@ 2020-07-17 19:18 Markus Elfring
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2020-07-17 19:18 UTC (permalink / raw)
  To: Wang Hai, netdev
  Cc: linux-kernel, Vishal Kulkarni, Santosh Raspatur, Jakub Kicinski,
	Divy Le Ray, David S. Miller

> Add the missed calls to fix it.

You propose to add only a single function call.


…
> +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
> @@ -3407,6 +3407,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  out_disable_device:
>  	pci_disable_device(pdev);
>  out:
> +	destroy_workqueue(cxgb3_wq);
>  	return err;
>  }

I suggest to adjust also the usage of the label “out” accordingly.

Regards,
Markus

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

end of thread, other threads:[~2020-07-18  7:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17  6:21 [PATCH] net: cxgb3: add missed destroy_workqueue in cxgb3 probe failure Wang Hai
2020-07-18  1:39 ` David Miller
2020-07-18  7:57   ` wanghai (M)
2020-07-17 19:18 Markus Elfring

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.