cciss: handler scsi_add_host failure
Subsystems (2)
PATCH 1/1 cciss: handler scsi_add_host failure
drivers/block/cciss_scsi.c +10 -5
@@ -691,14 +691,13 @@ static int cciss_scsi_detect(int ctlr) {struct Scsi_Host *sh; +int error; sh =scsi_host_alloc (&cciss_driver_template,sizeof (struct ctlr_info *));if (sh ==NULL ) -return 0 ; - + goto fail; sh->io_port =0 ;// good enough? FIXME, sh->n_io_port =0 ;// I don't think we use these two... - sh->this_id =SELF_SCSI_ID ; ((struct cciss_scsi_adapter_data_t *)
@@ -706,10 +705,16 @@ cciss_scsi_detect(int ctlr) sh->hostdata[0 ] = (unsigned long ) hba[ctlr]; sh->irq = hba[ctlr]->intr; sh->unique_id = sh->irq; -scsi_add_host (sh, &hba[ctlr]->pdev->dev);/* XXX handle failure */ + error =scsi_add_host (sh, &hba[ctlr]->pdev->dev); +if (error) + goto fail_host_put;scsi_scan_host (sh); -return 1 ; + + fail_host_put: +scsi_host_put (sh); + fail: +return 0 ; } static void __exit cleanup_cciss_module(void);
Mike, is this patch okay?
Quoted 28 lines · Christoph Hellwig
drivers/block/cciss_scsi.c +5
-4@@ -691,14 +691,13 @@ static int cciss_scsi_detect(int ctlr) {struct Scsi_Host *sh; +int error; sh =scsi_host_alloc (&cciss_driver_template,sizeof (struct ctlr_info *));if (sh ==NULL ) -return 0 ; - + goto fail; sh->io_port =0 ;// good enough? FIXME, sh->n_io_port =0 ;// I don't think we use these two... - sh->this_id =SELF_SCSI_ID ; ((struct cciss_scsi_adapter_data_t *)@@ -706,10 +705,16 @@ cciss_scsi_detect(int ctlr) sh->hostdata[0 ] = (unsigned long ) hba[ctlr]; sh->irq = hba[ctlr]->intr; sh->unique_id = sh->irq; -scsi_add_host (sh, &hba[ctlr]->pdev->dev);/* XXX handle failure */ + error =scsi_add_host (sh, &hba[ctlr]->pdev->dev); +if (error) + goto fail_host_put;scsi_scan_host (sh);
drivers/block/cciss_scsi.c cciss_scsi_detect(int ctlr) · line 720
Quoted 10 lines
drivers/block/cciss_scsi.c +5
-1-return 1 ; + + fail_host_put: +scsi_host_put (sh); + fail: +return 0 ; } static void __exit cleanup_cciss_module(void);
---end quoted text---