[PATCH] staging: comedi: ni_at_a2150: fix an always true condition test

H Hartley Sweeten hsweeten at visionengravers.com
Mon Dec 9 18:32:58 UTC 2013


As pointed out by the kbuild test robot, and Ian Abbott, the dma >= 0 test
is always true because dma is unsigned. This generates a warn message:

drivers/staging/comedi/drivers/ni_at_a2150.c:715 a2150_attach()
  warn: always true condition '(dma >= 0) => (0-u32max >= 0)'

Fix the test as suggested by Ian Abbott.

Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
Reported-by: kbuild test robot <fengguang.wu at intel.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 drivers/staging/comedi/drivers/ni_at_a2150.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c
index 0876bc5..0c71fdf 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -712,7 +712,7 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		}
 	}
 
-	if (dev->irq && ((dma >= 0 && dma <= 4) || (dma >= 5 && dma <= 7))) {
+	if (dev->irq && dma <= 7 && dma != 4) {
 		ret = request_dma(dma, dev->board_name);
 		if (ret == 0) {
 			devpriv->dma = dma;
-- 
1.8.4.4



More information about the devel mailing list