Skip to contentSkip to conversation

scsi: mpi3mr: Fix an error code when probing the driver

PATCH In review Zheyu Ma 2 participants 3 messages Apr 9, 2022 – Apr 13, 2022

Subsystems (2)
lore
Share & tools
lore

Zheyu Ma

author
#0 lore raw

PATCH 1/1 scsi: mpi3mr: Fix an error code when probing the driver

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

---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_os.c +3 -2
index f7cd70a15ea6..240bfdf9788b 100644
@@ -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,
Signature · 1 line
2.25.1
#1 lore raw
Quoted 14 lines · Zheyu Ma

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

---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_os.c +0 -0
index f7cd70a15ea6..240bfdf9788b 100644

drivers/scsi/mpi3mr/mpi3mr_os.c mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 4229

Quoted 10 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +3 -2
@@ -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.

Quoted 5 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +0 -1
        shost = scsi_host_alloc(&mpi3mr_driver_template,
--

2.25.1

Signature · 11 lines
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.
author
#2 lore raw
Quoted 19 lines · Sathya Prakash Veerichetty
Quoted 17 lines · Zheyu Ma

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

---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_os.c +0 -0
index f7cd70a15ea6..240bfdf9788b 100644
@@ -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;
 
Quoted 10 lines

drivers/scsi/mpi3mr/mpi3mr_os.c mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 4229

Quoted 7 lines
drivers/scsi/mpi3mr/mpi3mr_os.c +3 -2
-       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