Skip to content

Commit c6e939c

Browse files
arndbEnric Balletbo i Serra
authored andcommitted
platform/chrome: cros_ec_typec: fix clang -Wformat warning
Clang warns about using the %h format modifier to truncate an integer: drivers/platform/chrome/cros_ec_typec.c:1031:3: error: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Werror,-Wformat] typec->pd_ctrl_ver); ^~~~~~~~~~~~~~~~~~ include/linux/dev_printk.h:131:47: note: expanded from macro 'dev_dbg' dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \ ~~~ ^~~~~~~~~~~ Use an explicit bit mask to limit the number to its lower eight bits instead. Fixes: ad7c051 ("platform/chrome: cros_ec_typec: Update port info from EC") Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Enric Balletbo i Serra <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 639ff20 commit c6e939c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/platform/chrome/cros_ec_typec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,8 +1027,8 @@ static int cros_typec_get_cmd_version(struct cros_typec_data *typec)
10271027
else
10281028
typec->pd_ctrl_ver = 0;
10291029

1030-
dev_dbg(typec->dev, "PD Control has version mask 0x%hhx\n",
1031-
typec->pd_ctrl_ver);
1030+
dev_dbg(typec->dev, "PD Control has version mask 0x%02x\n",
1031+
typec->pd_ctrl_ver & 0xff);
10321032

10331033
return 0;
10341034
}

0 commit comments

Comments
 (0)