]> www.infradead.org Git - users/hch/misc.git/commitdiff
ASoC: tlv320aic32x4: use dev_err_probe() for regulators
authorMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
Mon, 25 Aug 2025 12:11:38 +0000 (14:11 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 25 Aug 2025 20:05:01 +0000 (21:05 +0100)
Avoid error messages like the following when the regulators have not
been probed yet:

    tlv320aic32x4 0-0018: Missing supply 'iov'
    tlv320aic32x4 0-0018: Failed to setup regulators

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Message-ID: <20250825121139.2150099-1-alexander.stein@ew.tq-group.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/tlv320aic32x4.c

index 7399080f8580c9d0b3865df797a813e8a5fb31af..715a07ab97b9f9de1487fb437e51a646ce53ec3c 100644 (file)
@@ -1277,8 +1277,8 @@ static int aic32x4_setup_regulators(struct device *dev,
        /* Check if the regulator requirements are fulfilled */
 
        if (IS_ERR(aic32x4->supply_iov)) {
-               dev_err(dev, "Missing supply 'iov'\n");
-               return PTR_ERR(aic32x4->supply_iov);
+               return dev_err_probe(dev, PTR_ERR(aic32x4->supply_iov),
+                                    "Missing supply 'iov'\n");
        }
 
        if (IS_ERR(aic32x4->supply_ldo)) {
@@ -1286,12 +1286,12 @@ static int aic32x4_setup_regulators(struct device *dev,
                        return -EPROBE_DEFER;
 
                if (IS_ERR(aic32x4->supply_dv)) {
-                       dev_err(dev, "Missing supply 'dv' or 'ldoin'\n");
-                       return PTR_ERR(aic32x4->supply_dv);
+                       return dev_err_probe(dev, PTR_ERR(aic32x4->supply_dv),
+                                            "Missing supply 'dv' or 'ldoin'\n");
                }
                if (IS_ERR(aic32x4->supply_av)) {
-                       dev_err(dev, "Missing supply 'av' or 'ldoin'\n");
-                       return PTR_ERR(aic32x4->supply_av);
+                       return dev_err_probe(dev, PTR_ERR(aic32x4->supply_av),
+                                            "Missing supply 'av' or 'ldoin'\n");
                }
        } else {
                if (PTR_ERR(aic32x4->supply_dv) == -EPROBE_DEFER)
@@ -1383,10 +1383,8 @@ int aic32x4_probe(struct device *dev, struct regmap *regmap,
        }
 
        ret = aic32x4_setup_regulators(dev, aic32x4);
-       if (ret) {
-               dev_err(dev, "Failed to setup regulators\n");
-               return ret;
-       }
+       if (ret)
+               return dev_err_probe(dev, ret, "Failed to setup regulators\n");
 
        if (aic32x4->rstn_gpio) {
                ndelay(10);