Unhandled error condition in aic7xxx
Subsystems (2)
PATCH 1/1 Unhandled error condition in aic7xxx
This patch should handle the case when scsi_add_host() fails.
Signed-off-by Daniel Walker <[email protected]>
drivers/scsi/aic7xxx/aic7xxx_osm.c +11 -2
@@ -996,6 +996,7 @@ ahc_linux_register_host(struct ahc_softcstruct Scsi_Host *host;char *new_name;u_long s; +int error =0 ; template->name = ahc->description; host =scsi_host_alloc (template,sizeof (struct ahc_softc *));
@@ -1029,8 +1030,16 @@ ahc_linux_register_host(struct ahc_softc host->transportt = ahc_linux_transport_template; -scsi_add_host (host, (ahc->dev_softc ? &ahc->dev_softc->dev :NULL ));/* XXX handle failure */ -scsi_scan_host (host); + error =scsi_add_host (host, (ahc->dev_softc ? &ahc->dev_softc->dev :NULL )); +if (error) { +/* +* Discard host variable on error. +*/ +scsi_host_put (host); +return (error); + } +scsi_scan_host (host); +return (0 ); }
Quoted 20 lines · On Thu, 01 Sep 2005 12:38:24 -0700 Daniel Walker wrote:
This patch should handle the case when
scsi_add_host()fails.Signed-off-by Daniel Walker <[email protected]>Index:
linux-2.6.13/drivers/scsi/aic7xxx/aic7xxx_osm.c
===================================================================drivers/scsi/aic7xxx/aic7xxx_osm.c +1
-0@@ -996,6 +996,7 @@ ahc_linux_register_host(struct ahc_softcstruct Scsi_Host *host;char *new_name;u_long s; +int error =0 ; template->name = ahc->description; host =scsi_host_alloc (template,sizeof (struct ahc_softc *));@@ -1029,8 +1030,16 @@ ahc_linux_register_host(struct ahc_softc host->transportt = ahc_linux_transport_template;
drivers/scsi/aic7xxx/aic7xxx_osm.c ahc_linux_register_host(struct ahc_softc · line 1039
Quoted 10 lines
drivers/scsi/aic7xxx/aic7xxx_osm.c +7
-2-scsi_add_host (host, (ahc->dev_softc ? &ahc->dev_softc->dev :NULL ));/* XXX handle failure */ -scsi_scan_host (host); + error =scsi_add_host (host, (ahc->dev_softc ? &ahc->dev_softc->dev :NULL )); +if (error) { +/* +* Discard host variable on error. +*/ +scsi_host_put (host); +return (error);
no parens on return, just: return error;
drivers/scsi/aic7xxx/aic7xxx_osm.c ahc_linux_register_host(struct ahc_softc · line 1044
Quoted 5 lines
drivers/scsi/aic7xxx/aic7xxx_osm.c +3
-0+ } +scsi_scan_host (host); +return (0 ); }
---
~Randy