From: Ian Abbott <abbotti@mev.co.uk>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: Greg KH <greg@kroah.com>,
"fmhess@users.sourceforge.net" <fmhess@users.sourceforge.net>,
Greg KH <gregkh@suse.de>, lkml <linux-kernel@vger.kernel.org>,
Ian Abbott <ian.abbott@mev.co.uk>, David Schleef <ds@schleef.org>
Subject: Re: staging: comedi: non working tests on unsigned cmd->convert_arg
Date: Thu, 23 Apr 2009 11:53:57 +0100 [thread overview]
Message-ID: <49F048C5.5040006@mev.co.uk> (raw)
In-Reply-To: <49F04192.6080300@gmail.com>
Roel Kluin wrote:
> Greg KH wrote:
>> On Wed, Apr 22, 2009 at 02:11:10PM -0400, Frank Mori Hess wrote:
>>> On Wednesday 22 April 2009, Greg KH wrote:
>>>> On Tue, Apr 21, 2009 at 03:18:10PM +0200, 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?)
>>>> I don't know. Let's ask the comedi developers :)
>>>>
>>>> Frank, what do you think about this?
>>> It looks like there already is such a test, right below the useless one the
>>> patch removes.
>> Ok, thanks for checking. Roel, care to resend these patches then?
>>
>> thanks,
>>
>> greg k-h
>>
> So you don't want to set cmd->*_arg to 0 when beyond 39 or below 0?
Well setting cmd->*_arg to 0 when beyond 39 would be a change of
functionality, so that's a no-no for a cleanup patch. And it would
never be below 0 because it's unsigned, so those 'if' statements in the
original were redundant.
> ------------------------------>8-------------8<---------------------------------
> Remove tests for negative unsigned.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
> index 30dec9d..a48b244 100644
> --- a/drivers/staging/comedi/drivers/s626.c
> +++ b/drivers/staging/comedi/drivers/s626.c
> @@ -1886,31 +1886,16 @@ static int s626_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s
> err++;
> }
>
> - if (cmd->start_src == TRIG_EXT && cmd->start_arg < 0) {
> - cmd->start_arg = 0;
> - err++;
> - }
> -
> if (cmd->start_src == TRIG_EXT && cmd->start_arg > 39) {
> cmd->start_arg = 39;
> err++;
> }
>
> - if (cmd->scan_begin_src == TRIG_EXT && cmd->scan_begin_arg < 0) {
> - cmd->scan_begin_arg = 0;
> - err++;
> - }
> -
> if (cmd->scan_begin_src == TRIG_EXT && cmd->scan_begin_arg > 39) {
> cmd->scan_begin_arg = 39;
> err++;
> }
>
> - if (cmd->convert_src == TRIG_EXT && cmd->convert_arg < 0) {
> - cmd->convert_arg = 0;
> - err++;
> - }
> -
> if (cmd->convert_src == TRIG_EXT && cmd->convert_arg > 39) {
> cmd->convert_arg = 39;
> err++;
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
prev parent reply other threads:[~2009-04-23 10:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-21 13:18 staging: comedi: non working tests on unsigned cmd->convert_arg Roel Kluin
2009-04-21 13:22 ` Roel Kluin
2009-04-22 16:50 ` Greg KH
2009-04-22 17:59 ` Ian Abbott
[not found] ` <200904221411.13851.fmhess@speakeasy.net>
2009-04-23 2:08 ` Greg KH
2009-04-23 10:23 ` Roel Kluin
2009-04-23 10:53 ` Ian Abbott [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49F048C5.5040006@mev.co.uk \
--to=abbotti@mev.co.uk \
--cc=ds@schleef.org \
--cc=fmhess@users.sourceforge.net \
--cc=greg@kroah.com \
--cc=gregkh@suse.de \
--cc=ian.abbott@mev.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=roel.kluin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox