Skip to contentSkip to conversation

Staging: comedi: drivers: comedi_test: Avoid multiple line dereference

PATCH In review Cheah Kok Cheong 2 participants 2 messages Feb 21, 2017 – Feb 22, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: comedi: drivers: comedi_test: Avoid multiple line dereference

Fix checkpatch warning "Avoid multiple line dereference" using a pointer variable to avoid line wrap.

---

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(-)
drivers/staging/comedi/drivers/comedi_test.c +4 -4
index 2a063f0..ccfd642 100644
@@ -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;
Signature · 1 line
2.7.4
Reviewed-by on v2 1/1
#1 lore raw
Quoted 25 lines · Cheah Kok Cheong

Fix checkpatch warning "Avoid multiple line dereference" using a pointer variable to avoid line wrap.

---

V2:

(quoted diff) +0 -2
-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(-)
drivers/staging/comedi/drivers/comedi_test.c +1 -0
index 2a063f0..ccfd642 100644
@@ -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;
 

drivers/staging/comedi/drivers/comedi_test.c static void waveform_ao_timer(unsigned long arg) · line 490

Quoted 10 lines
drivers/staging/comedi/drivers/comedi_test.c +3 -4
-				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!

Signature · 2 lines
-=( Ian Abbott @ MEV Ltd.    E-mail: <[email protected]> )=-
-=(                          Web: http://www.mev.co.uk/  )=-