summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
authorweiping zhang <zhangweiping@didichuxing.com>2017-08-10 20:52:17 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2017-08-25 05:29:06 +0300
commit92227b8d3d7fd0c9a5b78c3967a756e83a43b36d (patch)
treebda123f86f2955c302beda0245a926da16685ac2 /drivers/scsi/scsi_sysfs.c
parent085e56766f74e8fdafb0e988c150e28464747cdc (diff)
downloadlinux-92227b8d3d7fd0c9a5b78c3967a756e83a43b36d.tar.xz
scsi: scsi-sysfs: Adjust error returned for adapter reset request
If scsi_host_template->host_reset is NULL and the user requests an adapter reset through echo adapter > /sys/class/scsi_host/hostx/host_reset -EINVAL will be returned even though the "adapter" argument is perfectly valid. Change this so that we only return -EINVAL if the provided string is invalid. If the host does not implement a ->host_reset function we'll return -EOPNOTSUPP. [mkp: tweaked patch description] Signed-off-by: weiping zhang <zhangweiping@didichuxing.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index d6984df71f1c..41891db20108 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -303,6 +303,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)