All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: comedi: cb_pcidas64: Fixed coding issue about multiple line dereferencing
@ 2016-12-19 15:14 devendra sharma
  2016-12-19 18:12 ` Ian Abbott
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: devendra sharma @ 2016-12-19 15:14 UTC (permalink / raw)
  To: abbotti
  Cc: hsweeten, gregkh, ansonjacob.aj, amitoj1606, devel, linux-kernel,
	devendra sharma

Fixed coding issue about multiple line dereferencing

Signed-off-by: Devendra Sharma <devendra.sharma9091@gmail.com>
---
 drivers/staging/comedi/drivers/cb_pcidas64.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
index cb9c269..9ace9c0 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -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)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: comedi: cb_pcidas64: Fixed coding issue about multiple line dereferencing
  2016-12-19 15:14 [PATCH] staging: comedi: cb_pcidas64: Fixed coding issue about multiple line dereferencing devendra sharma
@ 2016-12-19 18:12 ` Ian Abbott
  2016-12-19 18:40 ` kbuild test robot
  2017-01-03 14:26 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Abbott @ 2016-12-19 18:12 UTC (permalink / raw)
  To: devendra sharma
  Cc: hsweeten, gregkh, ansonjacob.aj, amitoj1606, devel, linux-kernel

On 19/12/2016 15:14, devendra sharma wrote:
> Fixed coding issue about multiple line dereferencing
>
> Signed-off-by: Devendra Sharma <devendra.sharma9091@gmail.com>
> ---
>   drivers/staging/comedi/drivers/cb_pcidas64.c | 13 +++++--------
>   1 file changed, 5 insertions(+), 8 deletions(-)
>

I guess this is version 3 of the patch?

> diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
> index cb9c269..9ace9c0 100644
> --- a/drivers/staging/comedi/drivers/cb_pcidas64.c
> +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
> @@ -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.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: comedi: cb_pcidas64: Fixed coding issue about multiple line dereferencing
  2016-12-19 15:14 [PATCH] staging: comedi: cb_pcidas64: Fixed coding issue about multiple line dereferencing devendra sharma
  2016-12-19 18:12 ` Ian Abbott
@ 2016-12-19 18:40 ` kbuild test robot
  2017-01-03 14:26 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2016-12-19 18:40 UTC (permalink / raw)
  To: devendra sharma
  Cc: kbuild-all, abbotti, devel, ansonjacob.aj, gregkh,
	devendra sharma, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2145 bytes --]

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28854 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: comedi: cb_pcidas64: Fixed coding issue about multiple line dereferencing
  2016-12-19 15:14 [PATCH] staging: comedi: cb_pcidas64: Fixed coding issue about multiple line dereferencing devendra sharma
  2016-12-19 18:12 ` Ian Abbott
  2016-12-19 18:40 ` kbuild test robot
@ 2017-01-03 14:26 ` Greg KH
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2017-01-03 14:26 UTC (permalink / raw)
  To: devendra sharma; +Cc: abbotti, devel, ansonjacob.aj, linux-kernel

On Mon, Dec 19, 2016 at 08:44:28PM +0530, devendra sharma wrote:
> Fixed coding issue about multiple line dereferencing
> 
> Signed-off-by: Devendra Sharma <devendra.sharma9091@gmail.com>
> ---
>  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 :(

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-03 14:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 15:14 [PATCH] staging: comedi: cb_pcidas64: Fixed coding issue about multiple line dereferencing devendra sharma
2016-12-19 18:12 ` Ian Abbott
2016-12-19 18:40 ` kbuild test robot
2017-01-03 14:26 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.