summaryrefslogtreecommitdiff
path: root/drivers/iio/resolver
diff options
context:
space:
mode:
authorAlexandru Ardelean <aardelean@deviqon.com>2021-05-13 15:07:44 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2021-05-13 18:36:49 +0300
commitb0f27fca5a6c7652e265aae6a4452ce2f2ed64da (patch)
tree65c416ec7ddd9885aa9a06f5ffd6c4ee89d61310 /drivers/iio/resolver
parente32fe6d90f44922ccbb94016cfc3c238359e3e39 (diff)
downloadlinux-b0f27fca5a6c7652e265aae6a4452ce2f2ed64da.tar.xz
iio: adc: ad7192: handle regulator voltage error first
This change fixes a corner-case, where for a zero regulator value, the driver would exit early, initializing the driver only partially. The driver would be in an unknown state. This change reworks the code to check regulator_voltage() return value for negative (error) first, and return early. This is the more common idiom. Also, this change is removing the 'voltage_uv' variable and using the 'ret' value directly. The only place where 'voltage_uv' is being used is to compute the internal reference voltage, and the type of this variable is 'int' (same are for 'ret'). Using only 'ret' avoids having to assign it on the error path. Fixes: ab0afa65bbc7 ("staging: iio: adc: ad7192: fail probe on get_voltage") Cc: Alexandru Tachici <alexandru.tachici@analog.com> Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: <Stable@vger.kernel.org>
Diffstat (limited to 'drivers/iio/resolver')
0 files changed, 0 insertions, 0 deletions