[PATCH v2] regulator_get_optional: don't print an error when no regulator is found

Hans de Goede hdegoede at redhat.com
Thu Dec 12 08:31:16 EST 2013


Since regulator_get_optional is the only one calling _regulator_get() with
both allow_dummy and exclusive set to false this patch adds the following
test for calling dev_err:

    if (!(!allow_dummy && !exclusive))

Simplified to the much easier on the eyes:

    if (allow_dummy || exclusive)

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 drivers/regulator/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 3fe1313..a1d4ddc 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1346,7 +1346,8 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
 
 		rdev = dummy_regulator_rdev;
 		goto found;
-	} else {
+	/* Don't log an error when called from regulator_get_optional() */
+	} else if (allow_dummy || exclusive) {
 		dev_err(dev, "dummy supplies not allowed\n");
 	}
 
-- 
1.8.4.2




More information about the linux-arm-kernel mailing list