Re: [PATCH net-next] virtio_net: Fix error code in __virtnet_get_hw_stats()

From: Michael S. Tsirkin
Date: Wed May 15 2024 - 11:07:46 EST


On Wed, May 15, 2024 at 04:50:48PM +0200, Dan Carpenter wrote:
> On Sun, May 12, 2024 at 12:01:55PM -0400, Michael S. Tsirkin wrote:
> > On Fri, May 10, 2024 at 03:50:45PM +0300, Dan Carpenter wrote:
> > > The virtnet_send_command_reply() function returns true on success or
> > > false on failure. The "ok" variable is true/false depending on whether
> > > it succeeds or not. It's up to the caller to translate the true/false
> > > into -EINVAL on failure or zero for success.
> > >
> > > The bug is that __virtnet_get_hw_stats() returns false for both
> > > errors and success. It's not a bug, but it is confusing that the caller
> > > virtnet_get_hw_stats() uses an "ok" variable to store negative error
> > > codes.
> >
> > The bug is ... It's not a bug ....
> >
> > I think what you are trying to say is that the error isn't
> > really handled anyway, except for printing a warning,
> > so it's not a big deal.
> >
> > Right?
> >
>
> No, I'm sorry, that was confusing. The change to __virtnet_get_hw_stats()
> is a bugfix but the change to virtnet_get_hw_stats() was not a bugfix.
> I viewed this all as really one thing, because it's cleaning up the
> error codes which happens to fix a bug. It seems very related. At the
> same time, I can also see how people would disagree.
>
> I'm traveling until May 23. I can resend this. Probably as two patches
> for simpler review.
>
> regards,
> dan carpenter
>

Yea, no rush - bugfixes are fine after 23. And it's ok to combine into
one - we don't want inconsistent code - just please write a clear
commit log message.


--
MST