lkml.org 
[lkml]   [2020]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] usb: musb: remove unused variable 'devctl'
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

\
 
 \ /
  Last update: 2020-11-20 17:38    [W:0.036 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site