staging: comedi: das16: remove a duplicate condition
Subsystems (2)
PATCH 1/1 staging: comedi: das16: remove a duplicate condition
We checked that "it->options[3]" was non-zero on the line before so there is no need to check again.
drivers/staging/comedi/drivers/das16.c +1 -2
@@ -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 ;
Quoted 4 lines · 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 <[email protected]>
v
Quoted 5 lines
drivers/staging/comedi/drivers/das16.c +0
-0
drivers/staging/comedi/drivers/das16.c static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 1038
Quoted 9 lines
drivers/staging/comedi/drivers/das16.c +1
-2@@ -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,
Am 29.07.2015 23:36, schrieb Dan Carpenter:
Quoted 10 lines
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 <[email protected]>drivers/staging/comedi/drivers/das16.c +0
-0
drivers/staging/comedi/drivers/das16.c static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 1038
Quoted 9 lines
drivers/staging/comedi/drivers/das16.c +1
-2@@ -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
Quoted 14 lines · walter harms
Am 29.07.2015 23:36, schrieb Dan Carpenter:
Quoted 11 lines
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 <[email protected]>drivers/staging/comedi/drivers/das16.c +0
-0@@ -1032,8 +1032,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
Quoted 12 lines
drivers/staging/comedi/drivers/das16.c static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 1038
Quoted 8 lines
drivers/staging/comedi/drivers/das16.c +1
-2/* 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
Quoted 11 lines · 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 <[email protected]>drivers/staging/comedi/drivers/das16.c +0
-0
drivers/staging/comedi/drivers/das16.c static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) · line 1038
Quoted 9 lines
drivers/staging/comedi/drivers/das16.c +1
-2@@ -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 ;
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Web: http://www.mev.co.uk/ )=-