[PATCH v2 4/7] staging: mt7621-dma: Remove assignment in if

NeilBrown neil at brown.name
Wed Mar 21 23:14:13 UTC 2018


On Wed, Mar 21 2018, Christian Lütke-Stetzkamp wrote:

> Fixes checkpatch error: ASSIGN_IN_IF by adding an inner if in the else
> path, this also avoids calling vchan_find_desc when not needed.
>
> Signed-off-by: Christian Lütke-Stetzkamp <christian at lkamp.de>

Thanks.
You can add
  Reviewed-by: NeilBrown <neil at brown.name>

to this one too.

NeilBrown

> ---
>  drivers/staging/mt7621-dma/ralink-gdma.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/mt7621-dma/ralink-gdma.c b/drivers/staging/mt7621-dma/ralink-gdma.c
> index 9548ce4afb77..5646a09dd8c9 100644
> --- a/drivers/staging/mt7621-dma/ralink-gdma.c
> +++ b/drivers/staging/mt7621-dma/ralink-gdma.c
> @@ -689,8 +689,11 @@ static enum dma_status gdma_dma_tx_status(struct dma_chan *c,
>  				((chan->next_sg - 1) * desc->sg[0].len);
>  		else
>  			state->residue = desc->residue;
> -	} else if ((vdesc = vchan_find_desc(&chan->vchan, cookie)))
> -		state->residue = to_gdma_dma_desc(vdesc)->residue;
> +	} else {
> +		vdesc = vchan_find_desc(&chan->vchan, cookie);
> +		if (vdesc)
> +			state->residue = to_gdma_dma_desc(vdesc)->residue;
> +	}
>  	spin_unlock_irqrestore(&chan->vchan.lock, flags);
>  
>  	dev_dbg(c->device->dev, "tx residue %d bytes\n", state->residue);
> -- 
> 2.13.6
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/attachments/20180322/5713a269/attachment.asc>


More information about the devel mailing list