The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] remoteproc: st: fix check of syscon_regmap_lookup_by_phandle() return value
@ 2016-03-19 13:31 Vladimir Zapolskiy
  2016-03-21 11:54 ` Lee Jones
  2016-03-21 17:21 ` Bjorn Andersson
  0 siblings, 2 replies; 3+ messages in thread
From: Vladimir Zapolskiy @ 2016-03-19 13:31 UTC (permalink / raw)
  To: Bjorn Andersson, Ohad Ben-Cohen, Ludovic Barre; +Cc: Lee Jones, linux-kernel

syscon_regmap_lookup_by_phandle() returns either a valid pointer to
struct regmap or ERR_PTR() error value, check for NULL is invalid and
on error path may lead to oops, the change corrects the check.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
---
 drivers/remoteproc/st_remoteproc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/remoteproc/st_remoteproc.c b/drivers/remoteproc/st_remoteproc.c
index 6bb04d4..6f056ca 100644
--- a/drivers/remoteproc/st_remoteproc.c
+++ b/drivers/remoteproc/st_remoteproc.c
@@ -189,9 +189,9 @@ static int st_rproc_parse_dt(struct platform_device *pdev)
 	}
 
 	ddata->boot_base = syscon_regmap_lookup_by_phandle(np, "st,syscfg");
-	if (!ddata->boot_base) {
+	if (IS_ERR(ddata->boot_base)) {
 		dev_err(dev, "Boot base not found\n");
-		return -EINVAL;
+		return PTR_ERR(ddata->boot_base);
 	}
 
 	err = of_property_read_u32_index(np, "st,syscfg", 1,
-- 
2.1.4

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

end of thread, other threads:[~2016-03-21 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-19 13:31 [PATCH] remoteproc: st: fix check of syscon_regmap_lookup_by_phandle() return value Vladimir Zapolskiy
2016-03-21 11:54 ` Lee Jones
2016-03-21 17:21 ` Bjorn Andersson

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