From 3f8cf92740b4d7805b06d6123b60a2b09b8327d0 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Wed, 4 Aug 2010 21:54:26 +0200 Subject: [PATCH] --- yaml --- r: 219646 b: refs/heads/master c: d1ae4da731a6e049a675097ebfd9a02b9b50530e h: refs/heads/master v: v3 --- [refs] | 2 +- .../staging/iio/magnetometer/hmc5843.c | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index e459047ddaad..dc2c96467119 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e3a92cdedf3584e20e13511aab252a82d715f927 +refs/heads/master: d1ae4da731a6e049a675097ebfd9a02b9b50530e diff --git a/trunk/drivers/staging/iio/magnetometer/hmc5843.c b/trunk/drivers/staging/iio/magnetometer/hmc5843.c index 92f6c6fb90fe..ea5f749c5fe7 100644 --- a/trunk/drivers/staging/iio/magnetometer/hmc5843.c +++ b/trunk/drivers/staging/iio/magnetometer/hmc5843.c @@ -220,11 +220,15 @@ static ssize_t hmc5843_set_operating_mode(struct device *dev, int error; mutex_lock(&data->lock); error = strict_strtoul(buf, 10, &operating_mode); - if (error) - return error; + if (error) { + count = error; + goto exit; + } dev_dbg(dev, "set Conversion mode to %lu\n", operating_mode); - if (operating_mode > MODE_SLEEP) - return -EINVAL; + if (operating_mode > MODE_SLEEP) { + count = -EINVAL; + goto exit; + } status = i2c_smbus_write_byte_data(client, this_attr->address, operating_mode); @@ -437,18 +441,23 @@ static ssize_t set_range(struct device *dev, int error; mutex_lock(&data->lock); error = strict_strtoul(buf, 10, &range); - if (error) - return error; + if (error) { + count = error; + goto exit; + } dev_dbg(dev, "set range to %lu\n", range); - if (range > RANGE_6_5) - return -EINVAL; + if (range > RANGE_6_5) { + count = -EINVAL; + goto exit; + } data->range = range; range = range << RANGE_GAIN_OFFSET; if (i2c_smbus_write_byte_data(client, this_attr->address, range)) count = -EINVAL; +exit: mutex_unlock(&data->lock); return count;