]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: dac: ad5446: Don't ignore missing regulator
authorNuno Sá <nuno.sa@analog.com>
Tue, 4 Nov 2025 15:35:09 +0000 (15:35 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 9 Nov 2025 16:04:52 +0000 (16:04 +0000)
If the chip does not have an internal reference, do not ignore a missing
regulator as we won't be able to actually provide a proper scale for the
DAC. Since it's now seen as an error, flip the if() logic so errors are
treated first (which is the typical pattern).

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/dac/ad5446.c

index 4e4e080833d9169afb0cbcb0b817703bacc9cdba..f7ec652493226c4fef3c7ca6e977bed1cec3833e 100644 (file)
@@ -255,10 +255,11 @@ static int ad5446_probe(struct device *dev, const char *name,
        if (ret < 0 && ret != -ENODEV)
                return ret;
        if (ret == -ENODEV) {
-               if (chip_info->int_vref_mv)
-                       st->vref_mv = chip_info->int_vref_mv;
-               else
-                       dev_warn(dev, "reference voltage unspecified\n");
+               if (!chip_info->int_vref_mv)
+                       return dev_err_probe(dev, ret,
+                                            "reference voltage unspecified\n");
+
+               st->vref_mv = chip_info->int_vref_mv;
        } else {
                st->vref_mv = ret / 1000;
        }