[PATCH 4/7] staging: mt7621-dma: Remove assignment in if
NeilBrown
neil at brown.name
Tue Mar 20 22:21:55 UTC 2018
On Tue, Mar 20 2018, Christian Lütke-Stetzkamp wrote:
> Fixes checkpatch error: ASSIGN_IN_IF by defining a new variable before if
>
> Signed-off-by: Christian Lütke-Stetzkamp <christian at lkamp.de>
> ---
> drivers/staging/mt7621-dma/ralink-gdma.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/mt7621-dma/ralink-gdma.c b/drivers/staging/mt7621-dma/ralink-gdma.c
> index 9548ce4afb77..60d557fb6553 100644
> --- a/drivers/staging/mt7621-dma/ralink-gdma.c
> +++ b/drivers/staging/mt7621-dma/ralink-gdma.c
> @@ -678,6 +678,7 @@ static enum dma_status gdma_dma_tx_status(struct dma_chan *c,
>
> spin_lock_irqsave(&chan->vchan.lock, flags);
> desc = chan->desc;
> + vdesc = vchan_find_desc(&chan->vchan, cookie);
> if (desc && (cookie == desc->vdesc.tx.cookie)) {
> /*
> * We never update edesc->residue in the cyclic case, so we
> @@ -689,7 +690,7 @@ 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)))
> + } else if (vdesc)
> state->residue = to_gdma_dma_desc(vdesc)->residue;
> spin_unlock_irqrestore(&chan->vchan.lock, flags);
>
I don't like this change. We now call vchan_find_desc() in situations
where we didn't before. It isn't a very expensive function so that
doesn't matter a lot, but I think it is best not to do this.
If you want to remove the warning (and I'm not convinced that we need
to), please make it.
....
} else {
vdesc = vchan_find_desc(...);
if (vdesec)
state->residue = ...
}
Thanks,
NeilBrown
-------------- 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/20180321/1847a0aa/attachment.asc>
More information about the devel
mailing list