scsi: qedi: Fix SYSFS_FLAG_FW_SEL_BOOT formatting
authorFlorian Fainelli <f.fainelli@gmail.com>
Tue, 30 Nov 2021 20:38:12 +0000 (12:38 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 7 Dec 2021 03:17:18 +0000 (22:17 -0500)
The format used for formatting SYSFS_FLAG_FW_SEL_BOOT creates the
following warning:

drivers/scsi/qedi/qedi_main.c:2259:35: warning: format specifies type
'char' but the argument has type 'int' [-Wformat]
                   rc = snprintf(buf, 3, "%hhd\n",
SYSFS_FLAG_FW_SEL_BOOT);

Fix this to cast the constant as a char since the intention is to print it
via sysfs as a byte.

Link: https://lore.kernel.org/r/20211130203813.12138-2-f.fainelli@gmail.com
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qedi/qedi_main.c

index f1c93307088469c4786a4016f6c4d1cb917cc90c..832a856dd367bc0f2ca8634919086e032a6b2918 100644 (file)
@@ -2086,8 +2086,7 @@ static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf)
                rc = snprintf(buf, ip_len, fmt, gw);
                break;
        case ISCSI_BOOT_ETH_FLAGS:
-               rc = snprintf(buf, 3, "%hhd\n",
-                             SYSFS_FLAG_FW_SEL_BOOT);
+               rc = snprintf(buf, 3, "%d\n", (char)SYSFS_FLAG_FW_SEL_BOOT);
                break;
        case ISCSI_BOOT_ETH_INDEX:
                rc = snprintf(buf, 3, "0\n");
@@ -2254,7 +2253,7 @@ qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type,
                             mchap_secret);
                break;
        case ISCSI_BOOT_TGT_FLAGS:
-               rc = snprintf(buf, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT);
+               rc = snprintf(buf, 3, "%d\n", (char)SYSFS_FLAG_FW_SEL_BOOT);
                break;
        case ISCSI_BOOT_TGT_NIC_ASSOC:
                rc = snprintf(buf, 3, "0\n");