Patchwork [02/15] powerpc/rtas: Check RTAS presence when testing indicators

login
register
mail settings
Submitter Benjamin Herrenschmidt
Date April 5, 2011, 6:13 a.m.
Message ID <1301984051-18413-3-git-send-email-benh@kernel.crashing.org>
Download mbox | patch
Permalink /patch/89771/
State Superseded
Headers show

Comments

Benjamin Herrenschmidt - April 5, 2011, 6:13 a.m.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/kernel/rtas.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Michael Ellerman - April 5, 2011, 6:36 a.m.
On Tue, 2011-04-05 at 16:13 +1000, Benjamin Herrenschmidt wrote:
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>  arch/powerpc/kernel/rtas.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
> index 2097f2b..c2bfc4d 100644
> --- a/arch/powerpc/kernel/rtas.c
> +++ b/arch/powerpc/kernel/rtas.c
> @@ -591,6 +591,8 @@ bool rtas_indicator_present(int token, int *maxindex)
>  		u32 maxindex;
>  	} *indicators;
>  
> +	if (!rtas.dev)
> +		return false;
>  	indicators = of_get_property(rtas.dev, "rtas-indicators", &proplen);
>  	if (!indicators)
>  		return false;

Why? of_get_property() returns NULL if np is NULL, implemented in
of_find_property(). It doesn't look like a fast path.

cheers
Benjamin Herrenschmidt - April 5, 2011, 6:52 a.m.
> Why? of_get_property() returns NULL if np is NULL, implemented in
> of_find_property(). It doesn't look like a fast path.

Fun... not sure, I though I had a problem but maybe I don't remember
properly :-)

Cheers,
Ben.

Patch

diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 2097f2b..c2bfc4d 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -591,6 +591,8 @@  bool rtas_indicator_present(int token, int *maxindex)
 		u32 maxindex;
 	} *indicators;
 
+	if (!rtas.dev)
+		return false;
 	indicators = of_get_property(rtas.dev, "rtas-indicators", &proplen);
 	if (!indicators)
 		return false;