]> git.baikalelectronics.ru Git - kernel.git/commitdiff
iio: dac: ti-dac5571: fix an error code in probe()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 16 Aug 2021 18:39:54 +0000 (21:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Oct 2021 09:40:15 +0000 (11:40 +0200)
commit f7a28df7db84eb3410e9eca37832efa5aed93338 upstream.

If we have an unexpected number of channels then return -EINVAL instead
of returning success.

Fixes: 27587c900b6e ("iio: dac: add TI DAC5571 family support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20210816183954.GB2068@kili
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/dac/ti-dac5571.c

index 3a2bb0efe50de0f80607cf7b8dbaa72dbd5140c6..51c41ccf00ad9fa80569ca4258d7833781bcdb56 100644 (file)
@@ -352,6 +352,7 @@ static int dac5571_probe(struct i2c_client *client,
                data->dac5571_pwrdwn = dac5571_pwrdwn_quad;
                break;
        default:
+               ret = -EINVAL;
                goto err;
        }