[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().

Signed-off-by: Ingyu Jang <ingyujang25@xxxxxxxxxxx>
---
 drivers/scsi/scsi_sysfs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 24f6eefb6803..88f1b901d01b 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -1621,7 +1621,11 @@ 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;
 	transport_configure_device(&shost->shost_gendev);
 	return 0;
 }
-- 
2.34.1





[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