diff options
author | Michal Kubecek <mkubecek@suse.cz> | 2019-03-14 19:33:16 +0100 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2019-03-14 14:42:05 -0400 |
commit | 5da4e23263a21a25cc8615427a6a55b4d38c1e9b (patch) | |
tree | 3d8018528a6c556a267807a111a08656061affa1 | |
parent | 8612d8bf18b8098d038c5fbb3590ce34c9914b0b (diff) | |
download | ethtool-5da4e23263a21a25cc8615427a6a55b4d38c1e9b.tar.gz |
ethtool: qsfp: fix special value comparison
One of the warnings gcc issues when building ethtool with -Wall seems to
point to an actual problem:
qsfp.c: In function 'sff8636_show_dom':
qsfp.c:709:57: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if ((sd.sfp_temp[MCURR] == 0x0) || (sd.sfp_temp[MCURR] == 0xFFFF))
^~
Rather than writing the special value as -1 which would be a bit confusing,
cast 0xFFFF to __s16.
Fixes: a5e73bb05ee4 ("ethtool:QSFP Plus/QSFP28 Diagnostics Information Support")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | qsfp.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -706,7 +706,8 @@ static void sff8636_show_dom(const __u8 *id, __u32 eeprom_len) * current fields are supported or not. A valid temperature * reading is used as existence for TX/RX power. */ - if ((sd.sfp_temp[MCURR] == 0x0) || (sd.sfp_temp[MCURR] == 0xFFFF)) + if ((sd.sfp_temp[MCURR] == 0x0) || + (sd.sfp_temp[MCURR] == (__s16)0xFFFF)) return; printf("\t%-41s : %s\n", "Alarm/warning flags implemented", |