]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
bnxt_en: return proper error codes in bnxt_show_temp
authorEdwin Peer <edwin.peer@broadcom.com>
Mon, 21 Sep 2020 01:08:55 +0000 (21:08 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 9 Nov 2020 13:47:15 +0000 (14:47 +0100)
commitcdd632b37d8eb45602905d06cf99f0d80cc3b845
tree89320a4c31f10ddbad55fd00fb3c7867531ac982
parent4f3bca2e11eb90e24594d9a8db8c01988bcd4366
bnxt_en: return proper error codes in bnxt_show_temp

BugLink: https://bugs.launchpad.net/bugs/1899511
[ Upstream commit d69753fa1ecb3218b56b022722f7a5822735b876 ]

Returning "unknown" as a temperature value violates the hwmon interface
rules. Appropriate error codes should be returned via device_attribute
show instead. These will ultimately be propagated to the user via the
file system interface.

In addition to the corrected error handling, it is an even better idea to
not present the sensor in sysfs at all if it is known that the read will
definitely fail. Given that temp1_input is currently the only sensor
reported, ensure no hwmon registration if TEMP_MONITOR_QUERY is not
supported or if it will fail due to access permissions. Something smarter
may be needed if and when other sensors are added.

Fixes: 12cce90b934b ("bnxt_en: fix HWRM error when querying VF temperature")
Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Ian May <ian.may@canonical.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c