linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bluetooth-next V2] bluetooth: hci_sysfs: use strict_strtoul instead of simple_strtoul
@ 2010-03-09 19:38 Tomas Winkler
  2010-03-09 20:41 ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Tomas Winkler @ 2010-03-09 19:38 UTC (permalink / raw)
  To: marcel, linux-bluetooth; +Cc: guy.cohen, ron.rindjunsky, Tomas Winkler

use strict_strtoul as suggested by checkpatch.pl

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
V2:
1. more verbose commit message
2. return the error code that was produced by strict_strtoul 

 net/bluetooth/hci_sysfs.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 1a79a6c..dd11d61 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -282,12 +282,12 @@ static ssize_t show_idle_timeout(struct device *dev, struct device_attribute *at
 static ssize_t store_idle_timeout(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct hci_dev *hdev = dev_get_drvdata(dev);
-	char *ptr;
-	__u32 val;
+	unsigned long val;
+	int ret;
 
-	val = simple_strtoul(buf, &ptr, 10);
-	if (ptr == buf)
-		return -EINVAL;
+	ret = strict_strtoul(buf, 0, &val);
+	if (ret)
+		return ret;
 
 	if (val != 0 && (val < 500 || val > 3600000))
 		return -EINVAL;
@@ -306,12 +306,12 @@ static ssize_t show_sniff_max_interval(struct device *dev, struct device_attribu
 static ssize_t store_sniff_max_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct hci_dev *hdev = dev_get_drvdata(dev);
-	char *ptr;
-	__u16 val;
+	unsigned long val;
+	int ret;
 
-	val = simple_strtoul(buf, &ptr, 10);
-	if (ptr == buf)
-		return -EINVAL;
+	ret = strict_strtoul(buf, 0, &val);
+	if (ret)
+		return ret;
 
 	if (val < 0x0002 || val > 0xFFFE || val % 2)
 		return -EINVAL;
@@ -333,12 +333,12 @@ static ssize_t show_sniff_min_interval(struct device *dev, struct device_attribu
 static ssize_t store_sniff_min_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct hci_dev *hdev = dev_get_drvdata(dev);
-	char *ptr;
-	__u16 val;
+	unsigned long val;
+	int ret;
 
-	val = simple_strtoul(buf, &ptr, 10);
-	if (ptr == buf)
-		return -EINVAL;
+	ret = strict_strtoul(buf, 0, &val);
+	if (ret)
+		return ret;
 
 	if (val < 0x0002 || val > 0xFFFE || val % 2)
 		return -EINVAL;
-- 
1.6.6.1

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

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

end of thread, other threads:[~2010-03-12  0:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-09 19:38 [bluetooth-next V2] bluetooth: hci_sysfs: use strict_strtoul instead of simple_strtoul Tomas Winkler
2010-03-09 20:41 ` Marcel Holtmann
2010-03-09 21:13   ` Winkler, Tomas
2010-03-12  0:28     ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).