Skip to contentSkip to conversation

scsi_sysfs: Fix queue_ramp_up_period return code

PATCH RESEND In review Peter Oberparleiter 2 participants 2 messages Oct 27, 2015 – Oct 28, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 scsi_sysfs: Fix queue_ramp_up_period return code

Writing a number to /sys/bus/scsi/devices/<sdev>/queue_ramp_up_period returns the value of that number instead of the number of bytes written. This behavior can confuse programs expecting POSIX write() semantics. Fix this by returning the number of bytes written instead.

---
 drivers/scsi/scsi_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_sysfs.c +1 -1
index b333389..6b0f292 100644
@@ -898,7 +898,7 @@ sdev_store_queue_ramp_up_period(struct device *dev,
 		return -EINVAL;
 
 	sdev->queue_ramp_up_period = msecs_to_jiffies(period);
-	return period;
+	return count;
 }
 
 static DEVICE_ATTR(queue_ramp_up_period, S_IRUGO | S_IWUSR,
Signature · 1 line
2.3.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Peter Oberparleiter

Writing a number to /sys/bus/scsi/devices/<sdev>/queue_ramp_up_period returns the value of that number instead of the number of bytes written. This behavior can confuse programs expecting POSIX write() semantics. Fix this by returning the number of bytes written instead.

---
drivers/scsi/scsi_sysfs.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_sysfs.c +0 -0
index b333389..6b0f292 100644

drivers/scsi/scsi_sysfs.c sdev_store_queue_ramp_up_period(struct device *dev, · line 904

Quoted 8 lines
drivers/scsi/scsi_sysfs.c +1 -1
@@ -898,7 +898,7 @@ sdev_store_queue_ramp_up_period(struct device *dev,
 		return -EINVAL;
 
 	sdev->queue_ramp_up_period = msecs_to_jiffies(period);
-	return period;
+	return count;
 }
 
 static DEVICE_ATTR(queue_ramp_up_period, S_IRUGO | S_IWUSR,