Skip to content

Commit

Permalink
[SCSI] simscsi: Free scsi host on error
Browse files Browse the repository at this point in the history
If scsi_add_host returned an error, the host would never be freed.
We need to call scsi_host_put() if an error happens.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
Matthew Wilcox authored and James Bottomley committed Oct 12, 2007
1 parent c131993 commit a60ebc5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions arch/ia64/hp/sim/simscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,13 @@ simscsi_init(void)
return -ENOMEM;

error = scsi_add_host(host, NULL);
if (!error)
scsi_scan_host(host);
if (error)
goto free_host;
scsi_scan_host(host);
return 0;

free_host:
scsi_host_put(host);
return error;
}

Expand Down

0 comments on commit a60ebc5

Please sign in to comment.