powerpc/powernv: Handle unknown OPAL errors in opal_nvram_write()
authorNicholas Piggin <npiggin@gmail.com>
Mon, 26 Mar 2018 15:02:33 +0000 (01:02 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 30 Mar 2018 13:10:32 +0000 (00:10 +1100)
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 <npiggin@gmail.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Acked-by: Stewart Smith <stewart@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/powernv/opal-nvram.c

index 9db4398ded5de1f6c8e9a672a51008df1fbc85d7..ba2ff06a2c98b9315e99f2758cedd81903208a85 100644 (file)
@@ -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;
 }