summaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2018-12-12 23:10:31 -0800
committerSascha Hauer <s.hauer@pengutronix.de>2018-12-17 12:26:14 +0100
commit7036c933612dc7004b90d7d3c9d1a208d3a22db1 (patch)
treec2cd701a43307208217ce7c41442e8fe3f694063 /drivers/serial
parentc9b2899f6d2f5d9a2321b53c6a9e4158756a1a74 (diff)
downloadbarebox-7036c933612dc7004b90d7d3c9d1a208d3a22db1.tar.gz
serial: amba-pl011: Fix regulator_get() return check
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 <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/amba-pl011.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 4c4067d..ce40f84 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);