diff options
author | Dan Carpenter <error27@gmail.com> | 2010-08-10 05:37:33 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-31 18:40:35 (GMT) |
commit | 213fd2270450f7b5f98803e58bc25063c249e032 (patch) | |
tree | f74f3f4548db896173ddd25ccb80abe4c1c0adf9 /drivers/staging | |
parent | d1ae4da731a6e049a675097ebfd9a02b9b50530e (diff) | |
download | linux-fsl-qoriq-213fd2270450f7b5f98803e58bc25063c249e032.tar.xz |
Staging: iio: signedness bug
i2c_smbus_read_byte_data() returns an s32 type. We need to change
"rate" to signed for the error handling to work.
Also I changed it to propogate the error code instead of just returning
-EINVAL. Other error codes could be -EAGAIN for example.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/iio/magnetometer/hmc5843.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c index ea5f749..2b18280 100644 --- a/drivers/staging/iio/magnetometer/hmc5843.c +++ b/drivers/staging/iio/magnetometer/hmc5843.c @@ -389,11 +389,11 @@ static ssize_t show_sampling_frequency(struct device *dev, struct iio_dev *indio_dev = dev_get_drvdata(dev); struct i2c_client *client = to_i2c_client(indio_dev->dev.parent); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); - u32 rate; + s32 rate; rate = i2c_smbus_read_byte_data(client, this_attr->address); if (rate < 0) - return -EINVAL; + return rate; rate = (rate & RATE_BITMASK) >> RATE_OFFSET; return sprintf(buf, "%s\n", regval_to_samp_freq[rate]); } |