]> git.baikalelectronics.ru Git - kernel.git/commit
staging: iio: ad799x: remove some unneeded IS_ERR() checks
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 30 Apr 2014 21:05:00 +0000 (22:05 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 3 May 2014 10:14:01 +0000 (11:14 +0100)
commitf8ae549a1bb07f1cb28545fd9ee87b5d633e8448
tree6a4313bfd68288928201061539f0052777b57eb3
parent0dd3799a021258bf72abea49b703ebf6cf1f8170
staging: iio: ad799x: remove some unneeded IS_ERR() checks

My static checker is upset that we check IS_ERR(t->reg) when we know it
is not an ERR_PTR.

Checking for IS_ERR() twice is often a sign of confusion and buggy code.
In this case, if the call to "ret = regulator_enable(st->vref);" fails,
then we call "regulator_disable(st->vref);" and that's a mistake because
"st->vref" is not enabled.

I fixed these problems and Hartmut Knaack pointed out a couple unneeded
IS_ERR() checks in ad799x_remove() so I have removed those as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/ad799x.c