aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/scsi_sysfs.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index ce5224c92eda..931a7d954203 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -247,11 +247,11 @@ show_shost_active_mode(struct device *dev,
247 247
248static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL); 248static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL);
249 249
250static int check_reset_type(char *str) 250static int check_reset_type(const char *str)
251{ 251{
252 if (strncmp(str, "adapter", 10) == 0) 252 if (sysfs_streq(str, "adapter"))
253 return SCSI_ADAPTER_RESET; 253 return SCSI_ADAPTER_RESET;
254 else if (strncmp(str, "firmware", 10) == 0) 254 else if (sysfs_streq(str, "firmware"))
255 return SCSI_FIRMWARE_RESET; 255 return SCSI_FIRMWARE_RESET;
256 else 256 else
257 return 0; 257 return 0;
@@ -264,12 +264,9 @@ store_host_reset(struct device *dev, struct device_attribute *attr,
264 struct Scsi_Host *shost = class_to_shost(dev); 264 struct Scsi_Host *shost = class_to_shost(dev);
265 struct scsi_host_template *sht = shost->hostt; 265 struct scsi_host_template *sht = shost->hostt;
266 int ret = -EINVAL; 266 int ret = -EINVAL;
267 char str[10];
268 int type; 267 int type;
269 268
270 sscanf(buf, "%s", str); 269 type = check_reset_type(buf);
271 type = check_reset_type(str);
272
273 if (!type) 270 if (!type)
274 goto exit_store_host_reset; 271 goto exit_store_host_reset;
275 272