Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219646
b: refs/heads/master
c: d1ae4da
h: refs/heads/master
v: v3
  • Loading branch information
Julia Lawall authored and Greg Kroah-Hartman committed Aug 31, 2010
1 parent 648ec58 commit 3f8cf92
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e3a92cdedf3584e20e13511aab252a82d715f927
refs/heads/master: d1ae4da731a6e049a675097ebfd9a02b9b50530e
25 changes: 17 additions & 8 deletions trunk/drivers/staging/iio/magnetometer/hmc5843.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 3f8cf92

Please sign in to comment.