Re: staging: comedi: non working tests on unsigned cmd->convert_arg

From: Roel Kluin
Date: Tue Apr 21 2009 - 09:22:41 EST


Roel Kluin wrote:
> vi drivers/staging/comedi/comedi.h +342
>
> and note that cmd->convert_arg in s626_ai_cmdtest() is unsigned. Should there
> maybe be a test:
>
> if (cmd->convert_src == TRIG_EXT && cmd->convert_arg > MAX)
>
> (and what should MAX be then?)

The same question for cmd->scan_begin_arg and cmd->start_arg.

Otherwise you may want to apply the cleanup patch below
------------------------------>8-------------8<---------------------------------
Remove redundant tests on unsigned

Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
---

diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
index 30dec9d..637b0f1 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -1886,7 +1886,7 @@ static int s626_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s
err++;
}

- if (cmd->start_src == TRIG_EXT && cmd->start_arg < 0) {
+ if (cmd->start_src == TRIG_EXT) {
cmd->start_arg = 0;
err++;
}
@@ -1896,7 +1896,7 @@ static int s626_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s
err++;
}

- if (cmd->scan_begin_src == TRIG_EXT && cmd->scan_begin_arg < 0) {
+ if (cmd->scan_begin_src == TRIG_EXT) {
cmd->scan_begin_arg = 0;
err++;
}
@@ -1906,7 +1906,7 @@ static int s626_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s
err++;
}

- if (cmd->convert_src == TRIG_EXT && cmd->convert_arg < 0) {
+ if (cmd->convert_src == TRIG_EXT) {
cmd->convert_arg = 0;
err++;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/