Subject: Re: [net PATCH] net: stmmac: No need to calculate speed divider when offload is disabled

From: Simon Horman <[email-masked]>
Date: Mon, 17 Jun 2024 11:29:01 +0100

On Sun, Jun 16, 2024 at 09:15:05AM +0800, xiaolei wang wrote:
> 
> On 6/15/24 22:47, Simon Horman wrote:
> > On Fri, Jun 14, 2024 at 04:19:16PM +0800, Xiaolei Wang wrote:

...

> >          /* Final adjustments for HW */
> >          value = div_s64(qopt->idleslope * 1024ll * ptr, port_transmit_rate_kbps);
> >          priv->plat->tx_queues_cfg[queue].idle_slope = value & GENMASK(31, 0);
> > 
> >          value = div_s64(-qopt->sendslope * 1024ll * ptr, port_transmit_rate_kbps);
> >          priv->plat->tx_queues_cfg[queue].send_slope = value & GENMASK(31, 0);
> > 
> > And the div_s64() lines above appear to use
> > ptr uninitialised in the !qopt->enable case.
> 
> Oh, when deleting the configuration, idleslope and sendslope are both 0, do
> you mean we also need to set ptr to 0?

Understood, if idleslope and sendslope are 0, then ptr could be set to any
value and the result would be the same.  And, based on my limited
understanding, 0 does not seem to be a bad choice.

My point is that ptr shouldn't be uninitialised at this point.

...