From: Jonathan Cameron <jic23@cam.ac.uk>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch 1/2] Staging: iio: signedness bug
Date: Tue, 10 Aug 2010 09:40:00 +0000 [thread overview]
Message-ID: <4C611E70.5030902@cam.ac.uk> (raw)
In-Reply-To: <20100810053733.GO9031@bicker>
On 08/10/10 06:37, Dan Carpenter wrote:
> 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>
Thanks
>
> diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c
> index 92f6c6f..3d3bac4 100644
> --- a/drivers/staging/iio/magnetometer/hmc5843.c
> +++ b/drivers/staging/iio/magnetometer/hmc5843.c
> @@ -385,11 +385,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]);
> }
prev parent reply other threads:[~2010-08-10 9:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-10 5:37 [patch 1/2] Staging: iio: signedness bug Dan Carpenter
2010-08-10 9:40 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C611E70.5030902@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox