]> git.baikalelectronics.ru Git - kernel.git/commit
bnxt_en: fix ternary sign extension bug in bnxt_show_temp()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 22 Apr 2021 09:10:28 +0000 (12:10 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Apr 2021 21:56:38 +0000 (14:56 -0700)
commitf8556015e09fe57c1bea959bd3087082538e7b69
tree5913f0db28ff107ca58e6121894759d10118211a
parent761ed067fb5ad2ccf284934aeeccb3c274fc3679
bnxt_en: fix ternary sign extension bug in bnxt_show_temp()

The problem is that bnxt_show_temp() returns long but "rc" is an int
and "len" is a u32.  With ternary operations the type promotion is quite
tricky.  The negative "rc" is first promoted to u32 and then to long so
it ends up being a high positive value instead of a a negative as we
intended.

Fix this by removing the ternary.

Fixes: d6a89321046b ("bnxt_en: return proper error codes in bnxt_show_temp")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c