staging: iio: resolver: ad2s1210: fix not restoring sample gpio in channel read
authorDavid Lechner <dlechner@baylibre.com>
Thu, 21 Sep 2023 14:43:45 +0000 (09:43 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 24 Sep 2023 17:54:59 +0000 (18:54 +0100)
In theory, this code path should not be reachable because of the
previous switch statement. But just in case we should make sure we
are restoring the SAMPLE gpio to its original state before returning
in addition to releasing the mutex lock.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20230921144400.62380-5-dlechner@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/staging/iio/resolver/ad2s1210.c

index 7fb2d9e3196fea48f58b603ee9e560e8aad56353..f695ca0547e4cb651ffe5c6dc4740e0d29b9af61 100644 (file)
@@ -510,8 +510,8 @@ static int ad2s1210_read_raw(struct iio_dev *indio_dev,
                ret = IIO_VAL_INT;
                break;
        default:
-               mutex_unlock(&st->lock);
-               return -EINVAL;
+               ret = -EINVAL;
+               break;
        }
 
 error_ret: