powerpc/powernv: only register log if OPAL supports doing so
authorStewart Smith <stewart@linux.vnet.ibm.com>
Thu, 12 Feb 2015 05:25:27 +0000 (16:25 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 16 Mar 2015 07:50:13 +0000 (18:50 +1100)
Correct use of REGISTER/UNREGISTER is to check if the token exists
before calling. If we don't we get a "OPAL: Called with bad token 101 !"
error, which is harmless but may be alarming to some.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Acked-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/powernv/opal.c

index 18fd4e71c9c13c957bcade0d7b5ccb3190ebe2ca..45f0d9aa37331a830a9ec3fe2f707a22b298883a 100644 (file)
@@ -665,6 +665,9 @@ static void __init opal_dump_region_init(void)
        uint64_t size;
        int rc;
 
+       if (!opal_check_token(OPAL_REGISTER_DUMP_REGION))
+               return;
+
        /* Register kernel log buffer */
        addr = log_buf_addr_get();
        if (addr == NULL)
@@ -823,7 +826,8 @@ void opal_shutdown(void)
        }
 
        /* Unregister memory dump region */
-       opal_unregister_dump_region(OPAL_DUMP_REGION_LOG_BUF);
+       if (opal_check_token(OPAL_UNREGISTER_DUMP_REGION))
+               opal_unregister_dump_region(OPAL_DUMP_REGION_LOG_BUF);
 }
 
 /* Export this so that test modules can use it */