Re: [PATCH 2.6.13] Unhandled error condition in aic7xxx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> ===================================================================
> --- linux-2.6.13.orig/drivers/scsi/aic7xxx/aic7xxx_osm.c	2005-08-28 23:41:01.000000000 +0000
> +++ linux-2.6.13/drivers/scsi/aic7xxx/aic7xxx_osm.c	2005-08-31 18:45:20.000000000 +0000
> @@ -996,6 +996,7 @@ ahc_linux_register_host(struct ahc_softc
>  	struct	 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);

no parens on return, just: return error;

> +	} 
> + 	scsi_scan_host(host);
> +	
>  	return (0);
>  }



---
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux