Re: [PATCH] staging/comedi: Fix if(); by adding proper code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2013-02-14 21:36, Peter Huewe wrote:
Smatch warns about:
staging/comedi/drivers/cb_pcidas64.c:3304 prep_ao_dma() warn: if();

So the check currently does nothing and could be removed, but the better
alternative is to activate the check again and return -1; if it
evaluates to true.

Signed-off-by: Peter Huewe <peterhuewe@xxxxxx>
---
  drivers/staging/comedi/drivers/cb_pcidas64.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
index d33fc32..782498f 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -3301,7 +3301,8 @@ static int prep_ao_dma(struct comedi_device *dev, const struct comedi_cmd *cmd)
  	num_bytes = load_ao_dma_buffer(dev, cmd);
  	if (num_bytes == 0)
  		return -1;
-	if (num_bytes >= DMA_BUFFER_SIZE) ;
+	if (num_bytes >= DMA_BUFFER_SIZE)
+		return -1;
  	load_ao_dma(dev, cmd);

  	dma_start_sync(dev, 0);

I think the test is wrong as load_ao_dma_buffer can legitimately return DMA_BUFFER_SIZE. Probably best just to get rid of the test altogether.

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux