Re: [PATCH] hwmon: (pmbus/ibm-cffps) fix format-truncation warning
| Newsgroups | org.kernel.vger.linux-hwmon |
|---|---|
| Message-ID | <[email protected]> |
> snprintf() with "%02X" and "%04X" specifiers on an int argument > triggers -Wformat-truncation (and thus a build failure with > CONFIG_WERROR) because GCC assumes the int can hold a value wider > than the destination buffer. > > The value comes from i2c_smbus_read_byte_data() and > i2c_smbus_read_word_data(), which return at most 8 and 16 bits > respectively, so mask the value to make that explicit and silence > the warning. > > Signed-off-by: hanzhijian <[email protected]> Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1