Commit 601818bd authored by Luis de Bethencourt's avatar Luis de Bethencourt Committed by Greg Kroah-Hartman

staging: iio: accel: fix error check

commit ef3149eb upstream.

sca3000_read_ctrl_reg() returns a negative number on failure, check for
this instead of zero.
Signed-off-by: default avatarLuis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 784108d9
...@@ -595,7 +595,7 @@ static ssize_t sca3000_read_frequency(struct device *dev, ...@@ -595,7 +595,7 @@ static ssize_t sca3000_read_frequency(struct device *dev,
goto error_ret_mut; goto error_ret_mut;
ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL); ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL);
mutex_unlock(&st->lock); mutex_unlock(&st->lock);
if (ret) if (ret < 0)
goto error_ret; goto error_ret;
val = ret; val = ret;
if (base_freq > 0) if (base_freq > 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment