Skip to contentSkip to conversation

aic79xx_osm scsi_add_host error checking

PATCH In review Chuck Short 2 participants 2 messages May 30, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 aic79xx_osm scsi_add_host error checking

This patch checks for the return value of scsi_add_host.

Signed-off by: Chuck Short <[email protected]>

drivers/scsi/aic7xxx/aic79xx_osm.c +5 -2
diff -Naur linux-source-2.6.12-2.6.11.93.orig/drivers/scsi/aic7xxx/aic79xx_osm.c linux-source-2.6.12-2.6.11.93/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1989,7 +1989,8 @@
 	char	*new_name;
 	u_long	s;
 	u_long	target;
-
+	int error;
+	
 	template->name = ahd->description;
 	host = scsi_host_alloc(template, sizeof(struct ahd_softc *));
 	if (host == NULL)
@@ -2065,7 +2066,9 @@
 	ahd_unlock(ahd, &s);
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-	scsi_add_host(host, &ahd->dev_softc->dev); /* XXX handle failure */
+	error = scsi_add_host(host, &ahd->dev_softc->dev);
+	if (error)
+		return (ENOMEM);	
 	scsi_scan_host(host);
 #endif
 	return (0);

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

drivers/scsi/aic7xxx/aic79xx_osm.c line 1993

Quoted 11 lines · Chuck Short

This patch checks for the return value of scsi_add_host.

drivers/scsi/aic7xxx/aic79xx_osm.c +2 -1
@@ -1989,7 +1989,8 @@
 	char	*new_name;
 	u_long	s;
 	u_long	target;
-
+	int error;
+	

Trailing whitespace.

drivers/scsi/aic7xxx/aic79xx_osm.c line 2071

Quoted 11 lines
drivers/scsi/aic7xxx/aic79xx_osm.c +3 -1
 	template->name = ahd->description;
 	host = scsi_host_alloc(template, sizeof(struct ahd_softc *));
 	if (host = NULL)
@@ -2065,7 +2066,9 @@
 	ahd_unlock(ahd, &s);
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-	scsi_add_host(host, &ahd->dev_softc->dev); /* XXX handle failure */
+	error = scsi_add_host(host, &ahd->dev_softc->dev);
+	if (error)
+		return (ENOMEM);	

Trailing whitespace.

drivers/scsi/aic7xxx/aic79xx_osm.c line 2074

Quoted 3 lines
drivers/scsi/aic7xxx/aic79xx_osm.c +0 -0
 	scsi_scan_host(host);
 #endif
 	return (0);

Also, before scsi_add_host() there is, at least:

	host = scsi_host_alloc(template, sizeof(struct ahd_softc *));
	new_name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT);
	ahd->platform_data->dv_pid = kernel_thread(ahd_linux_dv_thread, ahd, 0);

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors