All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: mpi3mr: Fix an error code when probing the driver
@ 2022-04-09 13:49 Zheyu Ma
  2022-04-12 17:58 ` Sathya Prakash Veerichetty
  0 siblings, 1 reply; 3+ messages in thread
From: Zheyu Ma @ 2022-04-09 13:49 UTC (permalink / raw)
  To: sathya.prakash, kashyap.desai, sumit.saxena, sreekanth.reddy,
	jejb, martin.petersen
  Cc: mpi3mr-linuxdrv.pdl, linux-scsi, linux-kernel, Zheyu Ma

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

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

diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index f7cd70a15ea6..240bfdf9788b 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -4222,9 +4222,10 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	struct Scsi_Host *shost = NULL;
 	int retval = 0, i;
 
-	if (osintfc_mrioc_security_status(pdev)) {
+	retval = osintfc_mrioc_security_status(pdev);
+	if (retval) {
 		warn_non_secure_ctlr = 1;
-		return 1; /* For Invalid and Tampered device */
+		return retval; /* For Invalid and Tampered device */
 	}
 
 	shost = scsi_host_alloc(&mpi3mr_driver_template,
-- 
2.25.1


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

* Re: [PATCH] scsi: mpi3mr: Fix an error code when probing the driver
  2022-04-09 13:49 [PATCH] scsi: mpi3mr: Fix an error code when probing the driver Zheyu Ma
@ 2022-04-12 17:58 ` Sathya Prakash Veerichetty
  2022-04-13  9:27   ` Zheyu Ma
  0 siblings, 1 reply; 3+ messages in thread
From: Sathya Prakash Veerichetty @ 2022-04-12 17:58 UTC (permalink / raw)
  To: Zheyu Ma
  Cc: Kashyap Desai, Sumit Saxena, Sreekanth Reddy, jejb,
	Martin K. Petersen, mpi3mr-drvr-developers, linux-scsi,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2086 bytes --]

On Sat, Apr 9, 2022 at 7:49 AM Zheyu Ma <zheyuma97@gmail.com> wrote:
>
> During the process of driver probing, probe function should return < 0
> for failure, otherwise kernel will treat value >= 0 as success.
>
> Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> ---
>  drivers/scsi/mpi3mr/mpi3mr_os.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
> index f7cd70a15ea6..240bfdf9788b 100644
> --- a/drivers/scsi/mpi3mr/mpi3mr_os.c
> +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
> @@ -4222,9 +4222,10 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>         struct Scsi_Host *shost = NULL;
>         int retval = 0, i;
>
> -       if (osintfc_mrioc_security_status(pdev)) {
> +       retval = osintfc_mrioc_security_status(pdev);
> +       if (retval) {
>                 warn_non_secure_ctlr = 1;
> -               return 1; /* For Invalid and Tampered device */
> +               return retval; /* For Invalid and Tampered device */
>         }
NAK. The driver has to return 1 when invalid/tampered controllers are
detected just to say the controller is held by the mpi3mr driver
without any actual operation.
>
>         shost = scsi_host_alloc(&mpi3mr_driver_template,
> --
> 2.25.1
>

-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4227 bytes --]

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

* Re: [PATCH] scsi: mpi3mr: Fix an error code when probing the driver
  2022-04-12 17:58 ` Sathya Prakash Veerichetty
@ 2022-04-13  9:27   ` Zheyu Ma
  0 siblings, 0 replies; 3+ messages in thread
From: Zheyu Ma @ 2022-04-13  9:27 UTC (permalink / raw)
  To: Sathya Prakash Veerichetty
  Cc: Kashyap Desai, Sumit Saxena, Sreekanth Reddy, jejb,
	Martin K. Petersen, mpi3mr-drvr-developers, linux-scsi,
	linux-kernel

On Wed, Apr 13, 2022 at 1:58 AM Sathya Prakash Veerichetty
<sathya.prakash@broadcom.com> wrote:
>
> On Sat, Apr 9, 2022 at 7:49 AM Zheyu Ma <zheyuma97@gmail.com> wrote:
> >
> > During the process of driver probing, probe function should return < 0
> > for failure, otherwise kernel will treat value >= 0 as success.
> >
> > Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
> > ---
> >  drivers/scsi/mpi3mr/mpi3mr_os.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
> > index f7cd70a15ea6..240bfdf9788b 100644
> > --- a/drivers/scsi/mpi3mr/mpi3mr_os.c
> > +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
> > @@ -4222,9 +4222,10 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> >         struct Scsi_Host *shost = NULL;
> >         int retval = 0, i;
> >
> > -       if (osintfc_mrioc_security_status(pdev)) {
> > +       retval = osintfc_mrioc_security_status(pdev);
> > +       if (retval) {
> >                 warn_non_secure_ctlr = 1;
> > -               return 1; /* For Invalid and Tampered device */
> > +               return retval; /* For Invalid and Tampered device */
> >         }
> NAK. The driver has to return 1 when invalid/tampered controllers are
> detected just to say the controller is held by the mpi3mr driver
> without any actual operation.

Thanks for your explanation, I will drop this patch.

Zheyu Ma

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

end of thread, other threads:[~2022-04-13  9:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-09 13:49 [PATCH] scsi: mpi3mr: Fix an error code when probing the driver Zheyu Ma
2022-04-12 17:58 ` Sathya Prakash Veerichetty
2022-04-13  9:27   ` Zheyu Ma

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.