Skip to contentSkip to conversation

staging: comedi: drivers: dt282x: Merge if conditions

PATCH Superseded Amitoj Kaur Chawla 1 participant 1 message Feb 10, 2016 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 4/5 staging: comedi: drivers: dt282x: Merge if conditions

Merge if conditions with the same statements.

Found using Coccinelle. The semantic patch used to find this is as follows:

//<smpl>
@@
statement S;
expression e,x;
@@

* if(e)
(
{ ... return ...; }
&
S
)

* if(x)
(
{ ... return ...; }
&
S
)
//</smpl>

---
Changes in v2:

        -While merging use !x || !y instead of !(x && y)
 drivers/staging/comedi/drivers/dt282x.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/comedi/drivers/dt282x.c +1 -4
index 5a536a0..dc188c1 100644
@@ -887,10 +887,7 @@ static int dt282x_ao_inttrig(struct comedi_device *dev,
 	if (trig_num != cmd->start_src)
 		return -EINVAL;
 
-	if (!dt282x_ao_setup_dma(dev, s, 0))
-		return -EPIPE;
-
-	if (!dt282x_ao_setup_dma(dev, s, 1))
+	if (!dt282x_ao_setup_dma(dev, s, 0) || !dt282x_ao_setup_dma(dev, s, 1))
 		return -EPIPE;
 
 	outw(devpriv->supcsr | DT2821_SUPCSR_STRIG,
Signature · 1 line
1.9.1