linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] nfc: nci: add missed destroy_workqueue in nci_register_device
@ 2020-07-17  7:10 Wang Hai
  2020-07-17 20:08 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Wang Hai @ 2020-07-17  7:10 UTC (permalink / raw)
  To: davem, kuba, sameo, cuissard; +Cc: netdev, linux-kernel, wanghai38

When nfc_register_device fails in nci_register_device,
destroy_workqueue() shouled be called to destroy ndev->tx_wq.

Fixes: 3c1c0f5dc80b ("NFC: NCI: Fix nci_register_device init sequence")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
v1->v2:
 Change the module from "net: cxgb3:" to "nfc: nci:"
 net/nfc/nci/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 7cd524884304..78ea8c94dcba 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -1228,10 +1228,13 @@ int nci_register_device(struct nci_dev *ndev)
 
 	rc = nfc_register_device(ndev->nfc_dev);
 	if (rc)
-		goto destroy_rx_wq_exit;
+		goto destroy_tx_wq_exit;
 
 	goto exit;
 
+destroy_tx_wq_exit:
+	destroy_workqueue(ndev->tx_wq);
+
 destroy_rx_wq_exit:
 	destroy_workqueue(ndev->rx_wq);
 
-- 
2.17.1


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

* Re: [PATCH v2] nfc: nci: add missed destroy_workqueue in nci_register_device
  2020-07-17  7:10 [PATCH v2] nfc: nci: add missed destroy_workqueue in nci_register_device Wang Hai
@ 2020-07-17 20:08 ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2020-07-17 20:08 UTC (permalink / raw)
  To: wanghai38; +Cc: kuba, sameo, cuissard, netdev, linux-kernel

From: Wang Hai <wanghai38@huawei.com>
Date: Fri, 17 Jul 2020 15:10:16 +0800

> When nfc_register_device fails in nci_register_device,
> destroy_workqueue() shouled be called to destroy ndev->tx_wq.
> 
> Fixes: 3c1c0f5dc80b ("NFC: NCI: Fix nci_register_device init sequence")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wang Hai <wanghai38@huawei.com>
> ---
> v1->v2:
>  Change the module from "net: cxgb3:" to "nfc: nci:"

Applied, thanks.

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

* Re: [PATCH v2] nfc: nci: add missed destroy_workqueue in nci_register_device
@ 2020-07-17  7:47 Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2020-07-17  7:47 UTC (permalink / raw)
  To: Wang Hai, netdev
  Cc: kernel-janitors, linux-kernel, Vincent Cuissard, Samuel Ortiz,
	Jakub Kicinski, David S. Miller

> When nfc_register_device fails in nci_register_device,
> destroy_workqueue() shouled be called to destroy ndev->tx_wq.

Would an other imperative wording be preferred for the commit message?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=f8456690ba8eb18ea4714e68554e242a04f65cff#n151> +++ b/net/nfc/nci/core.c
> @@ -1228,10 +1228,13 @@  int nci_register_device(struct nci_dev *ndev)
>
>  	rc = nfc_register_device(ndev->nfc_dev);
>  	if (rc)
> -		goto destroy_rx_wq_exit;
> +		goto destroy_tx_wq_exit;
>
>  	goto exit;
>
> +destroy_tx_wq_exit:
> +	destroy_workqueue(ndev->tx_wq);
…


How do you think about to use the following source code variant
for this function implementation?

	if (!rc)
		goto exit;

	destroy_workqueue(ndev->tx_wq);


Regards,
Markus

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

end of thread, other threads:[~2020-07-17 20:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17  7:10 [PATCH v2] nfc: nci: add missed destroy_workqueue in nci_register_device Wang Hai
2020-07-17 20:08 ` David Miller
2020-07-17  7:47 Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).