Skip to content

Commit

Permalink
eth: fbnic: Avoid garbage value in fbnic_mac_get_sensor_asic()
Browse files Browse the repository at this point in the history
'fw_cmpl' is uninitialized which makes 'sensor' and '*val' to be stored
garbage value. Remove the whole body of fbnic_mac_get_sensor_asic() and
return -EOPNOTSUPP to fix this problem.

Fixes: d85ebad ("eth: fbnic: Add hardware monitoring support via HWMON interface")
Signed-off-by: Su Hui <suhui@nfschina.com>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: NipaLocal <nipa@local>
  • Loading branch information
Su Hui authored and NipaLocal committed Jan 3, 2025
1 parent aee4daa commit 4444e14
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions drivers/net/ethernet/meta/fbnic/fbnic_mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,23 +688,7 @@ fbnic_mac_get_eth_mac_stats(struct fbnic_dev *fbd, bool reset,

static int fbnic_mac_get_sensor_asic(struct fbnic_dev *fbd, int id, long *val)
{
struct fbnic_fw_completion fw_cmpl;
s32 *sensor;

switch (id) {
case FBNIC_SENSOR_TEMP:
sensor = &fw_cmpl.tsene.millidegrees;
break;
case FBNIC_SENSOR_VOLTAGE:
sensor = &fw_cmpl.tsene.millivolts;
break;
default:
return -EINVAL;
}

*val = *sensor;

return 0;
return -EOPNOTSUPP;
}

static const struct fbnic_mac fbnic_mac_asic = {
Expand Down

0 comments on commit 4444e14

Please sign in to comment.