staging/comedi: Fix if(); by adding proper code
PATCH 1/1 staging/comedi: Fix if(); by adding proper code
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.
--- drivers/staging/comedi/drivers/cb_pcidas64.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/staging/comedi/drivers/cb_pcidas64.c +2 -1
@@ -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 );
Signature · 1 line
1.7.8.6
Quoted 17 lines · Peter Huewe
Smatch warns about:
staging/comedi/drivers/cb_pcidas64.c:3304prep_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 <[email protected]>--- drivers/staging/comedi/drivers/cb_pcidas64.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)drivers/staging/comedi/drivers/cb_pcidas64.c +0
-0
drivers/staging/comedi/drivers/cb_pcidas64.c static int prep_ao_dma(struct comedi_device *dev, const struct comedi_cmd *cmd) · line 3308
Quoted 9 lines
drivers/staging/comedi/drivers/cb_pcidas64.c +2
-1@@ -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.
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
PATCH v2 1/1 staging/comedi: Remove if(); statement without effect
Smatch warns about:staging/comedi/drivers/cb_pcidas64.c:3304 prep_ao_dma() warn: if();
So the check currently does nothing and can be removed, as indicated by Ian.
---
v1 was staging/comedi: Fix if(); by adding proper code which was unfortunately wrong.
drivers/staging/comedi/drivers/cb_pcidas64.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/staging/comedi/drivers/cb_pcidas64.c +0 -1
@@ -3301,7 +3301,6 @@ 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 ) ;load_ao_dma (dev, cmd);dma_start_sync (dev,0 );
Signature · 1 line
1.7.8.6
Re: [PATCH v2] staging/comedi: Remove if(); statement without effect
Quoted 20 lines · Peter Huewe
Smatch warns about:
staging/comedi/drivers/cb_pcidas64.c:3304prep_ao_dma()warn:if();So the check currently does nothing and can be removed, as indicated by Ian.
Signed-off-by Peter Huewe <[email protected]>---
v1 was staging/comedi: Fixif(); by adding proper code which was unfortunately wrong.drivers/staging/comedi/drivers/cb_pcidas64.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)drivers/staging/comedi/drivers/cb_pcidas64.c +0
-0
drivers/staging/comedi/drivers/cb_pcidas64.c static int prep_ao_dma(struct comedi_device *dev, const struct comedi_cmd *cmd) · line 3306
Quoted 7 lines
drivers/staging/comedi/drivers/cb_pcidas64.c +0
-1@@ -3301,7 +3301,6 @@ 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 ) ;load_ao_dma (dev, cmd);dma_start_sync (dev,0 );
I suppose I'd better sign it off since you mentioned me. ;)
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-