Staging: comedi: range: remove unnecessary sanity check
PATCH 1/1 Staging: comedi: range: remove unnecessary sanity check
In reply to a message not in the archiveThis check is unnecessary because range_table will always be initialized to range_unknown by comedi_device_postconfig() for drivers that do not initialize range_table or range_table_list
---
Apply this after first patch
drivers/staging/comedi/range.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/staging/comedi/range.c +0 -4
@@ -143,10 +143,6 @@ int comedi_check_chanlist(struct comedi_subdevice *s, int n,unsigned int chanspec;int chan, range_len, i; -if (!s->range_table && !s->range_table_list) { -dev_err (dev->class_dev,"(bug) no range type list!\n" ); -return -EINVAL ; - }for (i =0 ; i < n; i++) { chanspec = chanlist[i]; chan =CR_CHAN (chanspec);
Signature · 1 line
1.8.5.3
Greg KH
maintainerQuoted 7 lines · Fred Akers
This check is unnecessary because
range_tablewill always be initialized torange_unknownbycomedi_device_postconfig()for drivers that do not initializerange_tableorrange_table_listSigned-off-by Fred Akers <[email protected]>---
Apply this after first patch
What "first" patch?
If you have patches that need a sequence, then send a series of patches, all numbered, like git will export for you, so I know for sure that I've gotten them all, and that they are in the correct order.
You don't want me to have to guess :)
Care to try again?
thanks,
greg k-h
PATCH v2 1/2 Staging: comedi: range: tidy up comedi_check_chanlist()
Refactor this function to remove an extra indent level
--- drivers/staging/comedi/range.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-)
drivers/staging/comedi/range.c +19 -20
@@ -143,29 +143,28 @@ int comedi_check_chanlist(struct comedi_subdevice *s, int n,unsigned int chanspec;int chan, range_len, i; -if (s->range_table || s->range_table_list) { -for (i =0 ; i < n; i++) { - chanspec = chanlist[i]; - chan =CR_CHAN (chanspec); -if (s->range_table) - range_len = s->range_table->length; -else if (s->range_table_list && chan < s->n_chan) - range_len = s->range_table_list[chan]->length; -else - range_len =0 ; -if (chan >= s->n_chan || -CR_RANGE (chanspec) >= range_len || -aref_invalid (s, chanspec)) { -dev_warn (dev->class_dev, -"bad chanlist[%d]=0x%08x chan=%d range length=%d\n" , - i, chanspec, chan, range_len); -return -EINVAL ; - } - } - }else { +if (!s->range_table && !s->range_table_list) {dev_err (dev->class_dev,"(bug) no range type list!\n" );return -EINVAL ; } +for (i =0 ; i < n; i++) { + chanspec = chanlist[i]; + chan =CR_CHAN (chanspec); +if (s->range_table) + range_len = s->range_table->length; +else if (s->range_table_list && chan < s->n_chan) + range_len = s->range_table_list[chan]->length; +else + range_len =0 ; +if (chan >= s->n_chan || +CR_RANGE (chanspec) >= range_len || +aref_invalid (s, chanspec)) { +dev_warn (dev->class_dev, +"bad chanlist[%d]=0x%08x chan=%d range length=%d\n" , + i, chanspec, chan, range_len); +return -EINVAL ; + } + }return 0 ; }EXPORT_SYMBOL_GPL (comedi_check_chanlist);
Signature · 1 line
1.8.5.3
PATCH v2 2/2 Staging: comedi: range: remove unnecessary sanity check
In reply to Greg KHThis check is unnecessary because range_table will always be initialized to range_unknown by comedi_device_postconfig() for drivers that do not initialize range_table or range_table_list
--- drivers/staging/comedi/range.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/staging/comedi/range.c +0 -4
@@ -143,10 +143,6 @@ int comedi_check_chanlist(struct comedi_subdevice *s, int n,unsigned int chanspec;int chan, range_len, i; -if (!s->range_table && !s->range_table_list) { -dev_err (dev->class_dev,"(bug) no range type list!\n" ); -return -EINVAL ; - }for (i =0 ; i < n; i++) { chanspec = chanlist[i]; chan =CR_CHAN (chanspec);
Signature · 1 line
1.8.5.3
Re: [PATCH v2 1/2] Staging: comedi: range: tidy up comedi_check_chanlist()
In reply to Fred AkersQuoted 3 lines · Fred Akers
Refactor this function to remove an extra indent level
Signed-off-by Fred Akers <[email protected]>
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
Quoted 15 lines · Fred Akers
This check is unnecessary because
range_tablewill always be initialized torange_unknownbycomedi_device_postconfig()for drivers that do not initializerange_tableorrange_table_listSigned-off-by Fred Akers <[email protected]>--- drivers/staging/comedi/range.c | 4 ---- 1 file changed, 4 deletions(-)drivers/staging/comedi/range.c +0
-0
drivers/staging/comedi/range.c int comedi_check_chanlist(struct comedi_subdevice *s, int n, · line 148
Quoted 10 lines
drivers/staging/comedi/range.c +0
-4@@ -143,10 +143,6 @@ int comedi_check_chanlist(struct comedi_subdevice *s, int n,unsigned int chanspec;int chan, range_len, i; -if (!s->range_table && !s->range_table_list) { -dev_err (dev->class_dev,"(bug) no range type list!\n" ); -return -EINVAL ; - }for (i =0 ; i < n; i++) { chanspec = chanlist[i]; chan =CR_CHAN (chanspec);
(Further down this for loop, the NULL-ness test on s->range_table_list is also technically redundant, but I think the code is clearer with the check left in, and is safer in a defensive way.)
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
Quoted 5 lines · Fred Akers
This check is unnecessary because
range_tablewill always be initialized torange_unknownbycomedi_device_postconfig()for drivers that do not initializerange_tableorrange_table_listSigned-off-by Fred Akers <[email protected]>
Just merge these two into one patch.
regards,
dan carpenter
RE: [PATCH v2 1/2] Staging: comedi: range: tidy up comedi_check_chanlist()
In reply to Fred AkersQuoted 4 lines · Fred Akers
Refactor this function to remove an extra indent level
Signed-off-by Fred Akers <[email protected]>
Thanks
Quoted 5 lines · Fred Akers
This check is unnecessary because
range_tablewill always be initialized torange_unknownbycomedi_device_postconfig()for drivers that do not initializerange_tableorrange_table_listSigned-off-by Fred Akers <[email protected]>
Thanks