All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi-sysfs: correct errno for host_reset
@ 2017-08-10 17:52 weiping zhang
  2017-08-14 12:30 ` weiping zhang
  2017-08-17  1:11 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: weiping zhang @ 2017-08-10 17:52 UTC (permalink / raw)
  To: jejb, martin.petersen; +Cc: linux-scsi

if scsi_host_template->host_reset is NULL, when user
"echo adapter > /sys/class/scsi_host/hostx/host_reset",
-EINVAL will return even string compare successfully. It make user confuse.

change to:
-EINVAL		if string not match "adapter" / "firmware";
-EOPNOTSUPP	if string match but not implement ->host_reset.

Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
---
 drivers/scsi/scsi_sysfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index dff8faf..3e664f4 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -272,6 +272,8 @@ store_host_reset(struct device *dev, struct device_attribute *attr,
 
 	if (sht->host_reset)
 		ret = sht->host_reset(shost, type);
+	else
+		ret = -EOPNOTSUPP;
 
 exit_store_host_reset:
 	if (ret == 0)
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-17  1:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-10 17:52 [PATCH] scsi-sysfs: correct errno for host_reset weiping zhang
2017-08-14 12:30 ` weiping zhang
2017-08-17  1:11 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.