Skip to contentSkip to conversation

drivers/isdn: eliminate duplicated test

PATCH Applied [email protected] 2 participants 2 messages Dec 22, 2009 – Jan 4, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 drivers/isdn: eliminate duplicated test

From: Julia Lawall <[email protected]>

The code checked slot_rx twice. Check slot_tx by analogy with the bank case.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression E;
@@

(
*E && E
|
*E || E
)
// </smpl>

---

 drivers/isdn/hardware/mISDN/hfcmulti.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/isdn/hardware/mISDN/hfcmulti.c renamed from drivers/isdn/hardware/mISDN/hfcmulti.c~drivers-isdn-eliminate-duplicated-test +1 -1
diff -puN drivers/isdn/hardware/mISDN/hfcmulti.c~drivers-isdn-eliminate-duplicated-test drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -3152,7 +3152,7 @@ static void
 hfcmulti_pcm(struct hfc_multi *hc, int ch, int slot_tx, int bank_tx,
     int slot_rx, int bank_rx)
 {
-	if (slot_rx < 0 || slot_rx < 0 || bank_tx < 0 || bank_rx < 0) {
+	if (slot_tx < 0 || slot_rx < 0 || bank_tx < 0 || bank_rx < 0) {
 		/* disable PCM */
 		mode_hfcmulti(hc, ch, hc->chan[ch].protocol, -1, 0, -1, 0);
 		return;

_