[Bionic][PATCH][SRU 1/3] powerpc/powernv: Handle unknown OPAL errors in opal_nvram_write()

Gustavo Walbon gwalbon at linux.vnet.ibm.com
Mon Apr 30 16:57:11 UTC 2018

From: Nicholas Piggin <npiggin at gmail.com>

BugLink: http://bugs.launchpad.net/bugs/1767927

opal_nvram_write currently just assumes success if it encounters an
error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO
on other errors instead.

Fixes: 628daa8d5abf ("powerpc/powernv: Add RTC and NVRAM support plus RTAS fallbacks")
Cc: stable at vger.kernel.org # v3.2+
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
Reviewed-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
Acked-by: Stewart Smith <stewart at linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
(cherry-picked from 741de617661794246f84a21a02fc5e327bffc9ad)
Signed-off-by: Gustavo Walbon <gwalbon at linux.vnet.ibm.com>
 arch/powerpc/platforms/powernv/opal-nvram.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c
index 9db4398ded5d..ba2ff06a2c98 100644
--- a/arch/powerpc/platforms/powernv/opal-nvram.c
+++ b/arch/powerpc/platforms/powernv/opal-nvram.c
@@ -59,6 +59,10 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
 		if (rc == OPAL_BUSY_EVENT)
+	if (rc)
+		return -EIO;
 	*index += count;
 	return count;

More information about the kernel-team mailing list