[PATCH 2/2] Add error checking and returning for transport_register_device() in scsi_sysfs_add_host()

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


The function transport_register_device() can return error code.
However, scsi_sysfs_add_host() currently does not check return value
of transport_register_device() and always returns 0.
Also, return value of scsi_sysfs_add_host() is
checked at drivers/scsi/hosts.c:307.

Therefore, this commit adds error checking for transport_register_device()
and returning error code in scsi_sysfs_add_host().
 drivers/scsi/scsi_sysfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 24f6eefb6803..1a322fbd420e 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -1621,7 +1621,10 @@ EXPORT_SYMBOL(scsi_register_interface);
 int scsi_sysfs_add_host(struct Scsi_Host *shost)
-	transport_register_device(&shost->shost_gendev);
+	int ret;
+	ret = transport_register_device(&shost->shost_gendev);
+	if (ret) 
+		return ret;
 	return 0;

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux