提交 a60ebc52 编写于 作者: M Matthew Wilcox 提交者: James Bottomley

[SCSI] simscsi: Free scsi host on error

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: NMatthew Wilcox <matthew@wil.cx>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 c131993b
...@@ -373,8 +373,13 @@ simscsi_init(void) ...@@ -373,8 +373,13 @@ simscsi_init(void)
return -ENOMEM; return -ENOMEM;
error = scsi_add_host(host, NULL); error = scsi_add_host(host, NULL);
if (!error) if (error)
scsi_scan_host(host); goto free_host;
scsi_scan_host(host);
return 0;
free_host:
scsi_host_put(host);
return error; return error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册