Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1585548 > unrolled thread

[PATCH v2] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference

Started byCheah Kok Cheong <thrust73@gmail.com>
First post2017-02-21 18:30 +0100
Last post2017-02-22 11:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference Cheah Kok Cheong <thrust73@gmail.com> - 2017-02-21 18:30 +0100
    Re: [PATCH v2] Staging: comedi: drivers: comedi_test: Avoid multiple  line dereference Ian Abbott <abbotti@mev.co.uk> - 2017-02-22 11:40 +0100

#1585548 — [PATCH v2] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference

FromCheah Kok Cheong <thrust73@gmail.com>
Date2017-02-21 18:30 +0100
Subject[PATCH v2] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference
Message-ID<tdmqd-5F2-5@gated-at.bofh.it>
Fix checkpatch warning "Avoid multiple line dereference"
using a pointer variable to avoid line wrap.

Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
---

V2:
-Use pointer instead of normal variable - Ian
-Variable is to be used as "write destination" and
 not as "read source" - Ian

 drivers/staging/comedi/drivers/comedi_test.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c
index 2a063f0..ccfd642 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -480,11 +480,11 @@ static void waveform_ao_timer(unsigned long arg)
 			/* output the last scan */
 			for (i = 0; i < cmd->scan_end_arg; i++) {
 				unsigned int chan = CR_CHAN(cmd->chanlist[i]);
+				unsigned short *pd;
 
-				if (comedi_buf_read_samples(s,
-							    &devpriv->
-							     ao_loopbacks[chan],
-							    1) == 0) {
+				pd = &devpriv->ao_loopbacks[chan];
+
+				if (!comedi_buf_read_samples(s, pd, 1)) {
 					/* unexpected underrun! (cancelled?) */
 					async->events |= COMEDI_CB_OVERFLOW;
 					goto underrun;
-- 
2.7.4

[toc] | [next] | [standalone]


#1586053 — Re: [PATCH v2] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference

FromIan Abbott <abbotti@mev.co.uk>
Date2017-02-22 11:40 +0100
SubjectRe: [PATCH v2] Staging: comedi: drivers: comedi_test: Avoid multiple line dereference
Message-ID<tdCuZ-eA-1@gated-at.bofh.it>
In reply to#1585548
On 21/02/17 17:25, Cheah Kok Cheong wrote:
> Fix checkpatch warning "Avoid multiple line dereference"
> using a pointer variable to avoid line wrap.
>
> Signed-off-by: Cheah Kok Cheong <thrust73@gmail.com>
> ---
>
> V2:
> -Use pointer instead of normal variable - Ian
> -Variable is to be used as "write destination" and
>  not as "read source" - Ian
>
>  drivers/staging/comedi/drivers/comedi_test.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c
> index 2a063f0..ccfd642 100644
> --- a/drivers/staging/comedi/drivers/comedi_test.c
> +++ b/drivers/staging/comedi/drivers/comedi_test.c
> @@ -480,11 +480,11 @@ static void waveform_ao_timer(unsigned long arg)
>  			/* output the last scan */
>  			for (i = 0; i < cmd->scan_end_arg; i++) {
>  				unsigned int chan = CR_CHAN(cmd->chanlist[i]);
> +				unsigned short *pd;
>
> -				if (comedi_buf_read_samples(s,
> -							    &devpriv->
> -							     ao_loopbacks[chan],
> -							    1) == 0) {
> +				pd = &devpriv->ao_loopbacks[chan];
> +
> +				if (!comedi_buf_read_samples(s, pd, 1)) {
>  					/* unexpected underrun! (cancelled?) */
>  					async->events |= COMEDI_CB_OVERFLOW;
>  					goto underrun;
>

Looks good, thanks!

Reviewed-by: Ian Abbott <abbotti@mev.co.uk>

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web