linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: qedf: Fix return values of the probe function
@ 2021-10-20 14:33 Zheyu Ma
  2021-10-21  4:27 ` [EXT] " Saurav Kashyap
  0 siblings, 1 reply; 2+ messages in thread
From: Zheyu Ma @ 2021-10-20 14:33 UTC (permalink / raw)
  To: jejb, martin.petersen, skashyap, jhasan, GR-QLogic-Storage-Upstream
  Cc: linux-scsi, linux-kernel, Zheyu Ma

qedf_set_fcoe_pf_param() propagates the return value to the probe
function __qedf_probe() and then hits local_pci_probe().

During the process of driver probing, the probe function should return < 0
for failure, otherwise, the kernel will treat value > 0 as success.

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
 drivers/scsi/qedf/qedf_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 42d0d941dba5..52f2a52bea2c 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -3161,14 +3161,14 @@ static int qedf_set_fcoe_pf_param(struct qedf_ctx *qedf)
 
 	if (!qedf->p_cpuq) {
 		QEDF_ERR(&(qedf->dbg_ctx), "dma_alloc_coherent failed.\n");
-		return 1;
+		return -ENOMEM;
 	}
 
 	rval = qedf_alloc_global_queues(qedf);
 	if (rval) {
 		QEDF_ERR(&(qedf->dbg_ctx), "Global queue allocation "
 			  "failed.\n");
-		return 1;
+		return rval;
 	}
 
 	/* Calculate SQ PBL size in the same manner as in qedf_sq_alloc() */
-- 
2.17.6


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

* RE: [EXT] [PATCH] scsi: qedf: Fix return values of the probe function
  2021-10-20 14:33 [PATCH] scsi: qedf: Fix return values of the probe function Zheyu Ma
@ 2021-10-21  4:27 ` Saurav Kashyap
  0 siblings, 0 replies; 2+ messages in thread
From: Saurav Kashyap @ 2021-10-21  4:27 UTC (permalink / raw)
  To: Zheyu Ma, jejb, martin.petersen, Javed Hasan, GR-QLogic-Storage-Upstream
  Cc: linux-scsi, linux-kernel

Hi Zheyu,
Thanks for the patch.

> -----Original Message-----
> From: Zheyu Ma <zheyuma97@gmail.com>
> Sent: Wednesday, October 20, 2021 8:03 PM
> To: jejb@linux.ibm.com; martin.petersen@oracle.com; Saurav Kashyap
> <skashyap@marvell.com>; Javed Hasan <jhasan@marvell.com>; GR-QLogic-
> Storage-Upstream <GR-QLogic-Storage-Upstream@marvell.com>
> Cc: linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; Zheyu Ma
> <zheyuma97@gmail.com>
> Subject: [EXT] [PATCH] scsi: qedf: Fix return values of the probe function
> 
> External Email
> 
> ----------------------------------------------------------------------
> qedf_set_fcoe_pf_param() propagates the return value to the probe
> function __qedf_probe() and then hits local_pci_probe().
> 
> During the process of driver probing, the probe function should return < 0
> for failure, otherwise, the kernel will treat value > 0 as success.
> 
> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> ---
>  drivers/scsi/qedf/qedf_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
> index 42d0d941dba5..52f2a52bea2c 100644
> --- a/drivers/scsi/qedf/qedf_main.c
> +++ b/drivers/scsi/qedf/qedf_main.c
> @@ -3161,14 +3161,14 @@ static int qedf_set_fcoe_pf_param(struct qedf_ctx
> *qedf)
> 
>  	if (!qedf->p_cpuq) {
>  		QEDF_ERR(&(qedf->dbg_ctx), "dma_alloc_coherent failed.\n");
> -		return 1;
> +		return -ENOMEM;
>  	}
> 
>  	rval = qedf_alloc_global_queues(qedf);
>  	if (rval) {
>  		QEDF_ERR(&(qedf->dbg_ctx), "Global queue allocation "
>  			  "failed.\n");
> -		return 1;
> +		return rval;
>  	}
> 
>  	/* Calculate SQ PBL size in the same manner as in qedf_sq_alloc() */
> --
> 2.17.6

Acked-by: Saurav Kashyap <skashyap@marvell.com>

Thanks,
~Saurav

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

end of thread, other threads:[~2021-10-21  4:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 14:33 [PATCH] scsi: qedf: Fix return values of the probe function Zheyu Ma
2021-10-21  4:27 ` [EXT] " Saurav Kashyap

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