[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240126113520.1356491-1-ingyujang25@unist.ac.kr>
Date: Fri, 26 Jan 2024 20:35:20 +0900
From: Ingyu Jang <ingyujang25@...st.ac.kr>
To: jejb@...ux.ibm.com
Cc: linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
ysjeon@...st.ac.kr
Subject: [PATCH 2/2] Add error checking and returning for transport_register_device() in scsi_sysfs_add_host()
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;
transport_configure_device(&shost->shost_gendev);
return 0;
}
--
2.34.1
Powered by blists - more mailing lists