On Thu, Nov 30, 2023 at 10:41:23AM +0800, Su Hui wrote:Oh, I missed this one. Thanks for pointing out this mistake!
error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data,aic7770_config() mostly returns positive error codes but I see it also
eisaBase);
if (error != 0) {
ahc->bsh.ioport = 0;
ahc_free(ahc);
- return (error);
+ return -error;
return -1 from ahc_reset(). So you'd want to do something like:
return error < 0 ? error : -error;
Agreed, it's better to let ahc_linux_register_host() only return negative error codes.@@ -1117,7 +1117,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templaOriginally ahc_linux_register_host() returned a mix of positive and
if (retval) {
printk(KERN_WARNING "aic7xxx: scsi_add_host failed\n");
scsi_host_put(host);
- return retval;
+ return -retval;
negative error codes. You have converted it to return only positive
error codes. That's good for consistency in a way, but it's a step
backwards from the big picture point of view.
}This should be done in a separate patch.
scsi_scan_host(host);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
index a07e94fac673..e17eb8df12c4 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -241,8 +241,8 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ahc_linux_pci_inherit_flags(ahc);
pci_set_drvdata(pdev, ahc);
- ahc_linux_register_host(ahc, &aic7xxx_driver_template);
- return (0);
+ error = ahc_linux_register_host(ahc, &aic7xxx_driver_template);
+ return -error;
patch 1: return negative error codes in ahc_linux_register_host()
patch 2: return negative error codes in aic7770_probe()
patch 3: add a check for errors in ahc_linux_pci_dev_probe()