NULL is used to designate a dummy regulator, so it it should be safe
to use against regulator_enable(). Any value that would retrun true
for IS_ERR(), OTOH, is not. Such value would also pass "if (r)" check
without any problems.

Fix the code to use !IS_ERR() instead.

Signed-off-by: Andrey Smirnov <[email protected]>
---
 drivers/serial/amba-pl011.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 4c4067d5b..ce40f840f 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -185,7 +185,7 @@ static int pl011_probe(struct amba_device *dev, const 
struct amba_id *id)
        struct regulator *r;
 
        r = regulator_get(&dev->dev, NULL);
-       if (r) {
+       if (!IS_ERR(r)) {
                int ret;
 
                ret = regulator_enable(r);
-- 
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to