From: Nicholas Piggin Date: Mon, 26 Mar 2018 15:02:33 +0000 (+1000) Subject: powerpc/powernv: Handle unknown OPAL errors in opal_nvram_write() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=741de617661794246f84a21a02fc5e327bffc9ad;p=openwrt%2Fstaging%2Fblogic.git powerpc/powernv: Handle unknown OPAL errors in opal_nvram_write() 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@vger.kernel.org # v3.2+ Signed-off-by: Nicholas Piggin Reviewed-by: Vasant Hegde Acked-by: Stewart Smith Signed-off-by: Michael Ellerman --- 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) opal_poll_events(NULL); } + + if (rc) + return -EIO; + *index += count; return count; }