Re: [PATCH] usb: musb: remove unused variable 'devctl'

From: Alan Stern
Date: Fri Nov 20 2020 - 11:38:05 EST


On Fri, Nov 20, 2020 at 05:32:44PM +0100, Greg Kroah-Hartman wrote:
> On Fri, Nov 20, 2020 at 11:15:19AM -0500, Alan Stern wrote:
> > > Perhaps you might want to add a comment here so that people will not
> > > keep making this same mistake when they run auto-checkers on the
> > > codebase?
> >
> > A better change would be
> >
> > - devctl = musb_readb(mbase, MUSB_DEVCTL);
> > + (void) musb_readb(mbase, MUSB_DEVCTL);
> >
> > and eliminate the unused variable. Then there wouldn't be any compiler
> > warning.
>
> No need for the (void), the compiler shouldn't warn about that, right?

True, but it clearly indicates to a human reader that the value was
intended to be read and thrown away. Alternatively, the (void) cast
could be left out and a comment added.

Alan Stern