Re: [PATCH v2] eth: fbnic: Avoid garbage value in fbnic_mac_get_sensor_asic()

From: Jakub Kicinski
Date: Mon Dec 30 2024 - 11:53:01 EST


On Mon, 30 Dec 2024 09:00:20 +0100 Michal Swiatkowski wrote:
> > @@ -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;
> Probably it should be:
> *fw_cmpl = fbd->cmpl_data
> but it is also never initialized.

The other way around, the completion declared on the stack should be
the thing that gets assigned to the pointer in fbd :S

> > - 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;
>
> It is more like removing broken functionality than fixing (maybe whole
> commit should be reverted). Anyway returning not support is also fine.

I defer to other maintainers. The gaps are trivial to fill in, we'll
do so as soon as this patch makes it to net-next (this patch needs to
target net).