staging: comedi: cb_pcidas64: Fixed coding issue about multiple line dereferencing
PATCH 1/1 staging: comedi: cb_pcidas64: Fixed coding issue about multiple line dereferencing
Fixed coding issue about multiple line dereferencing
--- drivers/staging/comedi/drivers/cb_pcidas64.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/staging/comedi/drivers/cb_pcidas64.c +5 -8
@@ -2475,20 +2475,17 @@ static int setup_channel_queue(struct comedi_device *dev,/* load external queue */ for (i =0 ; i < cmd->chanlist_len; i++) { bits =0 ; +unsigned int ch = cmd->chanlist[i];/* set channel */ - bits |=adc_chan_bits (CR_CHAN (cmd-> - chanlist[i])); + bits |=adc_chan_bits (CR_CHAN (ch));/* set gain */ bits |=ai_range_bits_6xxx (dev, -CR_RANGE (cmd-> - chanlist - [i])); +CR_RANGE (ch));/* set single-ended / differential */ bits |=se_diff_bit_6xxx (dev, -CR_AREF (cmd-> - chanlist[i]) == +CR_AREF (ch) ==AREF_DIFF ); -if (CR_AREF (cmd->chanlist[i]) ==AREF_COMMON ) +if (CR_AREF (ch) ==AREF_COMMON ) bits |=ADC_COMMON_BIT ;/* mark end of queue */ if (i == cmd->chanlist_len -1 )
Signature · 1 line
2.7.4
Quoted 7 lines · devendra sharma
Fixed coding issue about multiple line dereferencing
Signed-off-by Devendra Sharma <[email protected]>--- drivers/staging/comedi/drivers/cb_pcidas64.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
I guess this is version 3 of the patch?
drivers/staging/comedi/drivers/cb_pcidas64.c static int setup_channel_queue(struct comedi_device *dev, · line 2478
Quoted 9 lines
drivers/staging/comedi/drivers/cb_pcidas64.c +1
-0@@ -2475,20 +2475,17 @@ static int setup_channel_queue(struct comedi_device *dev,/* load external queue */ for (i =0 ; i < cmd->chanlist_len; i++) { bits =0 ; +unsigned int ch = cmd->chanlist[i];
Please put all declarations within a block before any statements in the block (in other words, avoid mixing declarations with code), and use a blank line to separate the declarations from the statements.
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Web: http://www.mev.co.uk/ )=-
kbuild test robot
build boturl: https://github.com/0day-ci/linux/commits/devendra-sharma/staging-comedi-cb_pcidas64-Fixed-coding-issue-about-multiple-line-dereferencing/20161220-020116 config: x86_64-randconfig-x017-201651…
Hi devendra,
[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.9 next-20161219]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/devendra-sharma/staging-comedi-cb_pcidas64-Fixed-coding-issue-about-multiple-line-dereferencing/20161220-020116
config: x86_64-randconfig-x017-201651 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 All warnings (new ones prefixed by >>):
drivers/staging/comedi/drivers/cb_pcidas64.c: In function 'setup_channel_queue':
>> drivers/staging/comedi/drivers/cb_pcidas64.c:2478:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
unsigned int ch = cmd->chanlist[i];
^~~~~~~~vim +2478 drivers/staging/comedi/drivers/cb_pcidas64.c
2462 /* use external queue */
2463 if (dev->write_subdev && dev->write_subdev->busy) {
2464 warn_external_queue(dev);
2465 return -EBUSY;
2466 }
2467 devpriv->hw_config_bits |= EXT_QUEUE_BIT;
2468 writew(devpriv->hw_config_bits,
2469 devpriv->main_iobase + HW_CONFIG_REG);
2470 /* clear DAC buffer to prevent weird interactions */
2471 writew(0,
2472 devpriv->main_iobase + DAC_BUFFER_CLEAR_REG);
2473 /* clear queue pointer */
2474 writew(0, devpriv->main_iobase + ADC_QUEUE_CLEAR_REG);
2475 /* load external queue */
2476 for (i = 0; i < cmd->chanlist_len; i++) {
2477 bits = 0;
> 2478 unsigned int ch = cmd->chanlist[i];
2479 /* set channel */
2480 bits |= adc_chan_bits(CR_CHAN(ch));
2481 /* set gain */
2482 bits |= ai_range_bits_6xxx(dev,
2483 CR_RANGE(ch));
2484 /* set single-ended / differential */
2485 bits |= se_diff_bit_6xxx(dev,
2486 CR_AREF(ch) ==
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Greg KH
maintainerQuoted 6 lines · devendra sharma
Fixed coding issue about multiple line dereferencing
Signed-off-by Devendra Sharma <[email protected]>--- drivers/staging/comedi/drivers/cb_pcidas64.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
Always test-build your changes so you don't get grumpy emails from maintainers asking you to always test-build your changes before sending them a patch :(