Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1361108 > unrolled thread

[PATCH] remoteproc: st: fix check of syscon_regmap_lookup_by_phandle() return value

Started byVladimir Zapolskiy <vz@mleia.com>
First post2016-03-19 14:40 +0100
Last post2016-03-21 18:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] remoteproc: st: fix check of syscon_regmap_lookup_by_phandle() return value Vladimir Zapolskiy <vz@mleia.com> - 2016-03-19 14:40 +0100
    Re: [PATCH] remoteproc: st: fix check of  syscon_regmap_lookup_by_phandle() return value Lee Jones <lee.jones@linaro.org> - 2016-03-21 13:00 +0100
    Re: [PATCH] remoteproc: st: fix check of syscon_regmap_lookup_by_phandle()  return value Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-03-21 18:30 +0100

#1361108 — [PATCH] remoteproc: st: fix check of syscon_regmap_lookup_by_phandle() return value

FromVladimir Zapolskiy <vz@mleia.com>
Date2016-03-19 14:40 +0100
Subject[PATCH] remoteproc: st: fix check of syscon_regmap_lookup_by_phandle() return value
Message-ID<repgJ-sb-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1361740 — Re: [PATCH] remoteproc: st: fix check of syscon_regmap_lookup_by_phandle() return value

FromLee Jones <lee.jones@linaro.org>
Date2016-03-21 13:00 +0100
SubjectRe: [PATCH] remoteproc: st: fix check of syscon_regmap_lookup_by_phandle() return value
Message-ID<rf6F4-52Q-15@gated-at.bofh.it>
In reply to#1361108
On Sat, 19 Mar 2016, Vladimir Zapolskiy wrote:

> 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(-)

Acked-by: Lee Jones <lee.jones@linaro.org>

> 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,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [next] | [standalone]


#1362021 — Re: [PATCH] remoteproc: st: fix check of syscon_regmap_lookup_by_phandle() return value

FromBjorn Andersson <bjorn.andersson@linaro.org>
Date2016-03-21 18:30 +0100
SubjectRe: [PATCH] remoteproc: st: fix check of syscon_regmap_lookup_by_phandle() return value
Message-ID<rfbOp-qS-1@gated-at.bofh.it>
In reply to#1361108
On Sat, Mar 19, 2016 at 6:31 AM, Vladimir Zapolskiy <vz@mleia.com> wrote:
> 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>

Applied, with Lee's ack.

Thanks,
Bjorn

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web