staging: wfx: don't print useless error messages
authorJérôme Pouiller <jerome.pouiller@silabs.com>
Tue, 17 Dec 2019 16:14:42 +0000 (16:14 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Dec 2019 14:55:57 +0000 (15:55 +0100)
During chip probing, if error does not come from secure boot (for
exemple when firmware has been found), others errors probably appears.

It is not necessary to say to user that the error does not come from
secure boot. So, drop the message saying "no error reported by secure
boot".

BTW, we take the opportunity to simplify print_boot_status().

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20191217161318.31402-13-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/fwio.c

index dbf8bda71ff75c43e5932278ae4311403c51fa2e..47e627bf0f8e1ae1de8f7a8ab6511b91f465262d 100644 (file)
@@ -61,7 +61,7 @@
 #define DCA_TIMEOUT  50 // milliseconds
 #define WAKEUP_TIMEOUT 200 // milliseconds
 
-static const char * const fwio_error_strings[] = {
+static const char * const fwio_errors[] = {
        [ERR_INVALID_SEC_TYPE] = "Invalid section type or wrong encryption",
        [ERR_SIG_VERIF_FAILED] = "Signature verification failed",
        [ERR_AES_CTRL_KEY] = "AES control key not initialized",
@@ -220,22 +220,16 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len)
 
 static void print_boot_status(struct wfx_dev *wdev)
 {
-       u32 val32;
+       u32 reg;
 
-       sram_reg_read(wdev, WFX_STATUS_INFO, &val32);
-       if (val32 == 0x12345678) {
-               dev_info(wdev->dev, "no error reported by secure boot\n");
-       } else {
-               sram_reg_read(wdev, WFX_ERR_INFO, &val32);
-               if (val32 < ARRAY_SIZE(fwio_error_strings) &&
-                   fwio_error_strings[val32])
-                       dev_info(wdev->dev, "secure boot error: %s\n",
-                                fwio_error_strings[val32]);
-               else
-                       dev_info(wdev->dev,
-                                "secure boot error: Unknown (0x%02x)\n",
-                                val32);
-       }
+       sram_reg_read(wdev, WFX_STATUS_INFO, &reg);
+       if (reg == 0x12345678)
+               return;
+       sram_reg_read(wdev, WFX_ERR_INFO, &reg);
+       if (reg < ARRAY_SIZE(fwio_errors) && fwio_errors[reg])
+               dev_info(wdev->dev, "secure boot: %s\n", fwio_errors[reg]);
+       else
+               dev_info(wdev->dev, "secure boot: Error %#02x\n", reg);
 }
 
 static int load_firmware_secure(struct wfx_dev *wdev)