mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] serial: amba-pl011: Fix regulator_get() return check
@ 2018-12-13  7:10 Andrey Smirnov
  2018-12-13  7:10 ` [PATCH 2/3] mci: Rely on NULL being a dummy regulator Andrey Smirnov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrey Smirnov @ 2018-12-13  7:10 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

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>
---
 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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-14 11:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13  7:10 [PATCH 1/3] serial: amba-pl011: Fix regulator_get() return check Andrey Smirnov
2018-12-13  7:10 ` [PATCH 2/3] mci: Rely on NULL being a dummy regulator Andrey Smirnov
2018-12-13  7:10 ` [PATCH 3/3] video: mtl017: Make sure errno is not used as a regulator pointer Andrey Smirnov
2018-12-14 11:11 ` [PATCH 1/3] serial: amba-pl011: Fix regulator_get() return check Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox