powerpc/powernv/flash: Check OPAL flash calls exist before using
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>
Tue, 14 Sep 2021 10:16:30 +0000 (15:46 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 22 May 2022 05:59:54 +0000 (15:59 +1000)
Currently only FSP based powernv systems supports firmware update
interfaces. Hence check that the token OPAL_FLASH_VALIDATE exists
before initalising the flash driver.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210914101630.30613-1-hegdevasant@linux.vnet.ibm.com
arch/powerpc/platforms/powernv/opal-flash.c

index 18481a8c52fa1b1db47867a97f3fc62d6af921d2..d5ea04e8e4c526b99ca8f1ab613266b385362d82 100644 (file)
@@ -520,6 +520,10 @@ void __init opal_flash_update_init(void)
 {
        int ret;
 
+       /* Firmware update is not supported by firmware */
+       if (!opal_check_token(OPAL_FLASH_VALIDATE))
+               return;
+
        /* Allocate validate image buffer */
        validate_flash_data.buf = kzalloc(VALIDATE_BUF_SIZE, GFP_KERNEL);
        if (!validate_flash_data.buf) {