Skip to contentSkip to conversation

staging: line6: use kstrtoint() instead of simple_strtoul()

PATCH In review Laurent Navet [Mali] 3 participants 3 messages Nov 29, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: line6: use kstrtoint() instead of simple_strtoul()

From: "Laurent Navet [Mali]" <[email protected]>

staging: line6: pcm.c
call to obsolete simple_strtoul() function is replaced by kstrtoint() in pcm_set_impulse_period(). Also check the return code.

---
 drivers/staging/line6/pcm.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/line6/pcm.c +7 -1
index a0ce781..876ab89 100644
@@ -81,7 +81,13 @@ static ssize_t pcm_set_impulse_period(struct device *dev,
 				      struct device_attribute *attr,
 				      const char *buf, size_t count)
 {
-	dev2pcm(dev)->impulse_period = simple_strtoul(buf, NULL, 10);
+        int value;
+        int rv;
+        rv = kstrtoint(buf, 10, &value);
+        if (rv < 0)
+		return rv;
+
+	dev2pcm(dev)->impulse_period = value;
 	return count;
 }
 
Signature · 1 line
1.7.10.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Laurent Navet [Mali]

From: "Laurent Navet [Mali]" <[email protected]>

staging: line6: pcm.c
call to obsolete simple_strtoul() function is replaced by kstrtoint() in pcm_set_impulse_period(). Also check the return code.

---
 drivers/staging/line6/pcm.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
#2 lore raw
In reply to Laurent Navet [Mali]
Quoted 17 lines · Laurent Navet [Mali]

From: "Laurent Navet [Mali]" <[email protected]>

staging: line6: pcm.c
call to obsolete simple_strtoul() function is replaced by kstrtoint() in pcm_set_impulse_period(). Also check the return code.

---
 drivers/staging/line6/pcm.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/staging/line6/pcm.c +0 -0
index a0ce781..876ab89 100644

drivers/staging/line6/pcm.c static ssize_t pcm_set_impulse_period(struct device *dev, · line 85

Quoted 6 lines
drivers/staging/line6/pcm.c +2 -1
@@ -81,7 +81,13 @@ static ssize_t pcm_set_impulse_period(struct device *dev,
 				      struct device_attribute *attr,
 				      const char *buf, size_t count)
 {
-	dev2pcm(dev)->impulse_period = simple_strtoul(buf, NULL, 10);
+        int value;
+        int rv;

This uses spaces instead of tabs. Run scripts/checkpatch.pl over the patch before submitting.

Put a blank line here between the declarations and the code.

I see that you copied "rv" from the other places in the file and generally matching the context is good, but in this case I think "rv" is non-standard. Normally we would use "ret" or "rc".

drivers/staging/line6/pcm.c static ssize_t pcm_set_impulse_period(struct device *dev, · line 88

Quoted 3 lines
drivers/staging/line6/pcm.c +3 -0
+        rv = kstrtoint(buf, 10, &value);
+        if (rv < 0)
+		return rv;

Could you fix up those small details and resend?

regards,
dan carpenter