Skip to contentSkip to conversation

staging: dgap: Merge two separate if conditions

PATCH In review Janani Ravichandran 3 participants 3 messages Feb 9, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: dgap: Merge two separate if conditions

Merge two if conditions with the same statements to avoid code duplication.

---
 drivers/staging/dgap/dgap.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/staging/dgap/dgap.c +1 -5
index bad3551..d7eb879 100644
@@ -2014,11 +2014,7 @@ static void dgap_poll_tasklet(unsigned long data)
 	if (bd->state == BOARD_READY) {
 		struct ev_t __iomem *eaddr;
 
-		if (!bd->re_map_membase) {
-			spin_unlock_irqrestore(&bd->bd_lock, lock_flags);
-			return;
-		}
-		if (!bd->re_map_port) {
+		if (!bd->re_map_membase || !bd->re_map_port) {
 			spin_unlock_irqrestore(&bd->bd_lock, lock_flags);
 			return;
 		}
Signature · 1 line
2.5.0
#1 lore raw
Quoted 6 lines · Janani Ravichandran

Merge two if conditions with the same statements to avoid code duplication.

---
 drivers/staging/dgap/dgap.c | 6 +-----

dgap is no longer in staging tree. Which tree are you using?

regards
sudip

#2 lore raw
Quoted 9 lines · Sudip Mukherjee
Quoted 6 lines · Janani Ravichandran

Merge two if conditions with the same statements to avoid code duplication.

---
 drivers/staging/dgap/dgap.c | 6 +-----

dgap is no longer in staging tree. Which tree are you using?

Even if the patch is not useful any more, you could use Coccinelle to see if there are other occurrences of the same situation.

julia