ntb.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: endpoint: pci-epf-vntb: Add missing check for alloc_workqueue
@ 2023-01-04  9:08 Jiasheng Jiang
  2023-04-08  9:33 ` Manivannan Sadhasivam
  0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2023-01-04  9:08 UTC (permalink / raw)
  To: jdmason, dave.jiang, allenbh, lpieralisi, kw, mani, kishon,
	bhelgaas
  Cc: ntb, linux-pci, linux-kernel, Jiasheng Jiang

Add check for the return value of alloc_workqueue since it may return
NULL pointer.

Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/pci/endpoint/functions/pci-epf-vntb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
index 04698e7995a5..05c99185ba65 100644
--- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
+++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
@@ -1441,6 +1441,9 @@ static int __init epf_ntb_init(void)
 
 	kpcintb_workqueue = alloc_workqueue("kpcintb", WQ_MEM_RECLAIM |
 					    WQ_HIGHPRI, 0);
+	if (!kpcintb_workqueue)
+		return -ENOMEM;
+
 	ret = pci_epf_register_driver(&epf_ntb_driver);
 	if (ret) {
 		destroy_workqueue(kpcintb_workqueue);
-- 
2.25.1


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

* Re: [PATCH] PCI: endpoint: pci-epf-vntb: Add missing check for alloc_workqueue
  2023-01-04  9:08 [PATCH] PCI: endpoint: pci-epf-vntb: Add missing check for alloc_workqueue Jiasheng Jiang
@ 2023-04-08  9:33 ` Manivannan Sadhasivam
  0 siblings, 0 replies; 2+ messages in thread
From: Manivannan Sadhasivam @ 2023-04-08  9:33 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: jdmason, dave.jiang, allenbh, lpieralisi, kw, kishon, bhelgaas,
	ntb, linux-pci, linux-kernel

On Wed, Jan 04, 2023 at 05:08:08PM +0800, Jiasheng Jiang wrote:
> Add check for the return value of alloc_workqueue since it may return
> NULL pointer.
> 
> Fixes: e35f56bb0330 ("PCI: endpoint: Support NTB transfer between RC and EP")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>

- Mani

> ---
>  drivers/pci/endpoint/functions/pci-epf-vntb.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> index 04698e7995a5..05c99185ba65 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> @@ -1441,6 +1441,9 @@ static int __init epf_ntb_init(void)
>  
>  	kpcintb_workqueue = alloc_workqueue("kpcintb", WQ_MEM_RECLAIM |
>  					    WQ_HIGHPRI, 0);
> +	if (!kpcintb_workqueue)
> +		return -ENOMEM;
> +
>  	ret = pci_epf_register_driver(&epf_ntb_driver);
>  	if (ret) {
>  		destroy_workqueue(kpcintb_workqueue);
> -- 
> 2.25.1
> 

-- 
மணிவண்ணன் சதாசிவம்

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

end of thread, other threads:[~2023-04-08  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-04  9:08 [PATCH] PCI: endpoint: pci-epf-vntb: Add missing check for alloc_workqueue Jiasheng Jiang
2023-04-08  9:33 ` Manivannan Sadhasivam

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).