[PATCH] staging: comedi: comedi_isadma: fix "stalled" detect in comedi_isadma_disable_on_sample()

Ian Abbott abbotti at mev.co.uk
Tue Feb 24 13:48:44 UTC 2015


On 23/02/15 20:22, H Hartley Sweeten wrote:
> The "stalled" variable this function is used to detect if the DMA operation
> is stalled while trying to disable DMA on a full comedi sample. The reset
> of this variable should only occur when the remaining bytes of the DMA
> transfer does not equal the remaining bytes from the last check.
>
> Reported-by: coverity (CID 1271132)
> Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
> Cc: Ian Abbott <abbotti at mev.co.uk>
> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
> ---
>   drivers/staging/comedi/drivers/comedi_isadma.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/comedi_isadma.c b/drivers/staging/comedi/drivers/comedi_isadma.c
> index dbdea71..e856f01 100644
> --- a/drivers/staging/comedi/drivers/comedi_isadma.c
> +++ b/drivers/staging/comedi/drivers/comedi_isadma.c
> @@ -91,9 +91,10 @@ unsigned int comedi_isadma_disable_on_sample(unsigned int dma_chan,
>   			stalled++;
>   			if (stalled > 10)
>   				break;
> +		} else {
> +			residue = new_residue;
> +			stalled = 0;
>   		}
> -		residue = new_residue;
> -		stalled = 0;
>   	}
>   	return residue;
>   }
>

This fix applies to linux-4.0-rc1 too.

Reviewed-by: Ian Abbott <abbotti at mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-


More information about the devel mailing list