* [patch] staging: comedi: das16: remove a duplicate condition
@ 2015-07-29 21:36 Dan Carpenter
2015-07-29 23:06 ` Hartley Sweeten
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Dan Carpenter @ 2015-07-29 21:36 UTC (permalink / raw)
To: kernel-janitors
We checked that "it->options[3]" was non-zero on the line before so
there is no need to check again.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c
index d7cf4b1..056bca9 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -1032,8 +1032,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* check that clock setting is valid */
if (it->options[3]) {
- if (it->options[3] != 0 &&
- it->options[3] != 1 && it->options[3] != 10) {
+ if (it->options[3] != 1 && it->options[3] != 10) {
dev_err(dev->class_dev,
"Invalid option. Master clock must be set to 1 or 10 (MHz)\n");
return -EINVAL;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [patch] staging: comedi: das16: remove a duplicate condition
2015-07-29 21:36 [patch] staging: comedi: das16: remove a duplicate condition Dan Carpenter
@ 2015-07-29 23:06 ` Hartley Sweeten
2015-07-30 7:18 ` walter harms
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Hartley Sweeten @ 2015-07-29 23:06 UTC (permalink / raw)
To: kernel-janitors
On Wednesday, July 29, 2015 2:37 PM, Dan Carpenter wrote:
> We checked that "it->options[3]" was non-zero on the line before so
> there is no need to check again.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
v
> diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c
> index d7cf4b1..056bca9 100644
> --- a/drivers/staging/comedi/drivers/das16.c
> +++ b/drivers/staging/comedi/drivers/das16.c
> @@ -1032,8 +1032,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>
> /* check that clock setting is valid */
> if (it->options[3]) {
> - if (it->options[3] != 0 &&
> - it->options[3] != 1 && it->options[3] != 10) {
> + if (it->options[3] != 1 && it->options[3] != 10) {
> dev_err(dev->class_dev,
> "Invalid option. Master clock must be set to 1 or 10 (MHz)\n");
> return -EINVAL;
Thanks,
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] staging: comedi: das16: remove a duplicate condition
2015-07-29 21:36 [patch] staging: comedi: das16: remove a duplicate condition Dan Carpenter
2015-07-29 23:06 ` Hartley Sweeten
@ 2015-07-30 7:18 ` walter harms
2015-07-30 8:30 ` Dan Carpenter
2015-07-30 9:31 ` Ian Abbott
3 siblings, 0 replies; 5+ messages in thread
From: walter harms @ 2015-07-30 7:18 UTC (permalink / raw)
To: kernel-janitors
Am 29.07.2015 23:36, schrieb Dan Carpenter:
> We checked that "it->options[3]" was non-zero on the line before so
> there is no need to check again.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c
> index d7cf4b1..056bca9 100644
> --- a/drivers/staging/comedi/drivers/das16.c
> +++ b/drivers/staging/comedi/drivers/das16.c
> @@ -1032,8 +1032,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>
> /* check that clock setting is valid */
> if (it->options[3]) {
> - if (it->options[3] != 0 &&
> - it->options[3] != 1 && it->options[3] != 10) {
> + if (it->options[3] != 1 && it->options[3] != 10) {
> dev_err(dev->class_dev,
> "Invalid option. Master clock must be set to 1 or 10 (MHz)\n");
> return -EINVAL;
mmh, acording to the error messages 1 or 10 is allowed, obviously 0 is/was also valid.
I would suggest to put that into one if () to make things more obvious.
It 0 is also valid a minor tweak to the error msg would be nice.
re,
wh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] staging: comedi: das16: remove a duplicate condition
2015-07-29 21:36 [patch] staging: comedi: das16: remove a duplicate condition Dan Carpenter
2015-07-29 23:06 ` Hartley Sweeten
2015-07-30 7:18 ` walter harms
@ 2015-07-30 8:30 ` Dan Carpenter
2015-07-30 9:31 ` Ian Abbott
3 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2015-07-30 8:30 UTC (permalink / raw)
To: kernel-janitors
On Thu, Jul 30, 2015 at 09:18:56AM +0200, walter harms wrote:
>
>
> Am 29.07.2015 23:36, schrieb Dan Carpenter:
> > We checked that "it->options[3]" was non-zero on the line before so
> > there is no need to check again.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c
> > index d7cf4b1..056bca9 100644
> > --- a/drivers/staging/comedi/drivers/das16.c
> > +++ b/drivers/staging/comedi/drivers/das16.c
> > @@ -1032,8 +1032,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
> >
> > /* check that clock setting is valid */
> > if (it->options[3]) {
> > - if (it->options[3] != 0 &&
> > - it->options[3] != 1 && it->options[3] != 10) {
> > + if (it->options[3] != 1 && it->options[3] != 10) {
> > dev_err(dev->class_dev,
> > "Invalid option. Master clock must be set to 1 or 10 (MHz)\n");
> > return -EINVAL;
>
> mmh, acording to the error messages 1 or 10 is allowed, obviously 0 is/was also valid.
> I would suggest to put that into one if () to make things more obvious.
> It 0 is also valid a minor tweak to the error msg would be nice.
Zero values are not used. If you are going to set it then it has to be
1 or 10. The message makes sense and matches the logic of the code.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] staging: comedi: das16: remove a duplicate condition
2015-07-29 21:36 [patch] staging: comedi: das16: remove a duplicate condition Dan Carpenter
` (2 preceding siblings ...)
2015-07-30 8:30 ` Dan Carpenter
@ 2015-07-30 9:31 ` Ian Abbott
3 siblings, 0 replies; 5+ messages in thread
From: Ian Abbott @ 2015-07-30 9:31 UTC (permalink / raw)
To: kernel-janitors
On 29/07/15 22:36, Dan Carpenter wrote:
> We checked that "it->options[3]" was non-zero on the line before so
> there is no need to check again.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c
> index d7cf4b1..056bca9 100644
> --- a/drivers/staging/comedi/drivers/das16.c
> +++ b/drivers/staging/comedi/drivers/das16.c
> @@ -1032,8 +1032,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>
> /* check that clock setting is valid */
> if (it->options[3]) {
> - if (it->options[3] != 0 &&
> - it->options[3] != 1 && it->options[3] != 10) {
> + if (it->options[3] != 1 && it->options[3] != 10) {
> dev_err(dev->class_dev,
> "Invalid option. Master clock must be set to 1 or 10 (MHz)\n");
> return -EINVAL;
>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=-
-=( Web: http://www.mev.co.uk/ )=-
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-07-30 9:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-29 21:36 [patch] staging: comedi: das16: remove a duplicate condition Dan Carpenter
2015-07-29 23:06 ` Hartley Sweeten
2015-07-30 7:18 ` walter harms
2015-07-30 8:30 ` Dan Carpenter
2015-07-30 9:31 ` Ian Abbott
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).