path: root/drivers/staging/iio/accel/lis3l02dq_core.c
diff options
authorAndreas Ruprecht <rupran@einserver.de>2011-11-27 23:17:41 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-29 10:12:06 +0900
commit359f9caa4df27ca0546a787d086f4c06306300b6 (patch)
tree7098af5b3aab63a302ff924352aa90149b3651c4 /drivers/staging/iio/accel/lis3l02dq_core.c
parentbae5b537539f0c64843fa4b037eafe7808182677 (diff)
Staging: iio/accel: Changed data type for val to unsigned long in write_frequency
In lis3102dq_write_frequency() we used a long variable to store the value parsed from the char* buffer buf, as there only was a strict_strtol() function to parse values. Now we have got kstrto* which allows us to convert to the right data type in most cases. In this particular function we want to write a frequency value, and it doesn't make sense to allow negative values here (as Dan Carpenter pointed out in a previous email). This means we can now parse the value into an unsigned long and get an error for invalid (e.g. negative) values. Signed-off-by: Andreas Ruprecht <rupran@einserver.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/accel/lis3l02dq_core.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c
index 4dbe4c7d361..5da40b33186 100644
--- a/drivers/staging/iio/accel/lis3l02dq_core.c
+++ b/drivers/staging/iio/accel/lis3l02dq_core.c
@@ -332,11 +332,11 @@ static ssize_t lis3l02dq_write_frequency(struct device *dev,
size_t len)
struct iio_dev *indio_dev = dev_get_drvdata(dev);
- long val;
+ unsigned long val;
int ret;
u8 t;
- ret = strict_strtol(buf, 10, &val);
+ ret = kstrtoul(buf, 10, &val);
if (ret)
return ret;