diff mbox

[3/4] powerpc/powernv: Check OPAL elog calls exist before using

Message ID 1408423682-14297-3-git-send-email-mikey@neuling.org (mailing list archive)
State Accepted
Commit 7dc992ec7b3fd875b05f49f454a922ee94af330b
Delegated to: Michael Ellerman
Headers show

Commit Message

Michael Neuling Aug. 19, 2014, 4:48 a.m. UTC
Check that the OPAL_ELOG_READ token exists before initalising the elog
infrastructure.

This avoids littering the OPAL console with:
  "OPAL: Called with bad token 74"

Signed-off-by: Michael Neuling <mikey@neuling.org>
---
 arch/powerpc/platforms/powernv/opal-elog.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Michael Ellerman Sept. 15, 2014, 3:13 a.m. UTC | #1
On Tue, 2014-08-19 at 14:48 +1000, Michael Neuling wrote:
> Check that the OPAL_ELOG_READ token exists before initalising the elog
> infrastructure.
> 
> This avoids littering the OPAL console with:
>   "OPAL: Called with bad token 74"
> 
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---
>  arch/powerpc/platforms/powernv/opal-elog.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/powernv/opal-elog.c b/arch/powerpc/platforms/powernv/opal-elog.c
> index bbdb3ff..518fe95 100644
> --- a/arch/powerpc/platforms/powernv/opal-elog.c
> +++ b/arch/powerpc/platforms/powernv/opal-elog.c
> @@ -295,6 +295,10 @@ int __init opal_elog_init(void)
>  {
>  	int rc = 0;
>  
> +	/* ELOG not supported by firmware */
> +	if (!opal_check_token(OPAL_ELOG_READ))
> +		return -1;
> +

The only caller does:

			/* Setup error log interface */
			rc = opal_elog_init();
			/* Setup code update interface */
			opal_flash_init();
			/* Setup platform dump extract interface */
			opal_platform_dump_init();
			/* Setup system parameters interface */
			opal_sys_param_init();
			/* Setup message log interface. */
			opal_msglog_init();
		}
	
		return 0;
	}


So we may as well have it return void. Wanna send a follow-up patch for that.

cheers
diff mbox

Patch

diff --git a/arch/powerpc/platforms/powernv/opal-elog.c b/arch/powerpc/platforms/powernv/opal-elog.c
index bbdb3ff..518fe95 100644
--- a/arch/powerpc/platforms/powernv/opal-elog.c
+++ b/arch/powerpc/platforms/powernv/opal-elog.c
@@ -295,6 +295,10 @@  int __init opal_elog_init(void)
 {
 	int rc = 0;
 
+	/* ELOG not supported by firmware */
+	if (!opal_check_token(OPAL_ELOG_READ))
+		return -1;
+
 	elog_kset = kset_create_and_add("elog", NULL, opal_kobj);
 	if (!elog_kset) {
 		pr_warn("%s: failed to create elog kset\n", __func__);