Skip to contentSkip to conversation

staging: comedi: drivers: dt282x: Merge if conditions

PATCH In review Amitoj Kaur Chawla 2 participants 2 messages Feb 10, 2016 – Feb 12, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 5/6 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>

---
 drivers/staging/comedi/drivers/dt282x.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/comedi/drivers/dt282x.c +1 -4
index 5a536a0..ded985e 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
maintainer
#1 lore raw
Quoted 36 lines · Amitoj Kaur Chawla

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>

---
 drivers/staging/comedi/drivers/dt282x.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/comedi/drivers/dt282x.c +0 -0
index 5a536a0..ded985e 100644

drivers/staging/comedi/drivers/dt282x.c static int dt282x_ao_inttrig(struct comedi_device *dev, · line 891

Quoted 9 lines
drivers/staging/comedi/drivers/dt282x.c +1 -4
@@ -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;

Still not going to take this, sorry.

greg k-h