Re: [PATCH 01/12] thunderbolt: dma_port: Remove unused variable 'ret'

From: Mika Westerberg
Date: Wed Jan 27 2021 - 12:03:13 EST


Hi,

On Wed, Jan 27, 2021 at 04:19:16PM +0000, Lee Jones wrote:
> On Wed, 27 Jan 2021, Andy Shevchenko wrote:
>
> > On Wednesday, January 27, 2021, Lee Jones <lee.jones@xxxxxxxxxx> wrote:
> >
> > > Fixes the following W=1 kernel build warning(s):
> > >
> > > drivers/thunderbolt/dma_port.c: In function ‘dma_port_flash_write_block’:
> > > drivers/thunderbolt/dma_port.c:331:6: warning: variable ‘ret’ set but
> > > not used [-Wunused-but-set-variable]
> > >
> > >
> > Is it scripted somehow?
>
> A script opens up the file on the warning line.
>
> The patch is hand-written.
>
> > Because I am not sure we are okay to simply drop the assignment.
>
> I've been careful not to change the semantics of the code.
>
> The return value has never been checked since the driver's inception 4
> years ago.
>
> However, if this is an oversight and the intention was to check the
> value and error-out during a failure condition, I can make that
> happen.
>
> I would need a nod from the author before I make such a change.

It's actually an oversight from my side. It should do something like:

if (ret)
return ret:

there. Feel free to fix it up :)

Thanks!