iio: adc: ti-ads1298: Fix error code in probe()
authorDan Carpenter <dan.carpenter@linaro.org>
Thu, 22 Feb 2024 06:14:25 +0000 (09:14 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 28 Feb 2024 19:26:36 +0000 (19:26 +0000)
There is a copy and paste bug here, it should be "reg_vref" instead of
"reg_avdd".  The "priv->reg_avdd" variable is zero so it ends up
returning success.

Fixes: 00ef7708fa60 ("iio: adc: ti-ads1298: Add driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Mike Looijmans <mike.looijmans@topic.nl>
Link: https://lore.kernel.org/r/5f393a87-ca8b-4e68-a6f4-a79f75a91ccb@moroto.mountain
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ti-ads1298.c

index ed895a30beedcb6aa25b9178557e290557107a6a..67637f1abdc745ca5256ab4146ce098f390d052a 100644 (file)
@@ -657,7 +657,7 @@ static int ads1298_probe(struct spi_device *spi)
        priv->reg_vref = devm_regulator_get_optional(dev, "vref");
        if (IS_ERR(priv->reg_vref)) {
                if (PTR_ERR(priv->reg_vref) != -ENODEV)
-                       return dev_err_probe(dev, PTR_ERR(priv->reg_avdd),
+                       return dev_err_probe(dev, PTR_ERR(priv->reg_vref),
                                             "Failed to get vref regulator\n");
 
                priv->reg_vref = NULL;