[POWERPC] Make rtas_call() safe if RTAS hasn't been initialised
authorMichael Ellerman <michael@ellerman.id.au>
Fri, 23 Jun 2006 08:20:10 +0000 (18:20 +1000)
committerPaul Mackerras <paulus@samba.org>
Wed, 28 Jun 2006 01:59:47 +0000 (11:59 +1000)
Currently it's unsafe to call rtas_call() prior to rtas_initialize(). This
is because the rtas.entry value hasn't been setup and so we don't know
where to enter, but we just try anyway.

We can't do anything intelligent without rtas.entry, so if it's not set, just
return. Code that calls rtas_call() early needs to be aware that the call
might fail.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/rtas.c

index 17dc79198515d8f61f0879b10e9535dbbe5be9ab..0f14c2e63a670486947abcd114099c0c28e701af 100644 (file)
@@ -328,7 +328,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...)
        char *buff_copy = NULL;
        int ret;
 
-       if (token == RTAS_UNKNOWN_SERVICE)
+       if (!rtas.entry || token == RTAS_UNKNOWN_SERVICE)
                return -1;
 
        /* Gotta do something different here, use global lock for now... */