Skip to contentSkip to conversation

Fix dead code in cdrom/gscd.c

PATCH In review Eric Sesterhenn 2 participants 2 messages Mar 8, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix dead code in cdrom/gscd.c

hi,

this fixes Coverity Bugs #21 and #22. In both cases the do { ... } while (result != 6 || result == 0x0E) just finishes for result == 6, so the if(result != 6) doesnt make much sense.

This patch simply removes the if statement, so the logic stays the same.

drivers/cdrom/gscd.c renamed from drivers/cdrom/gscd.c.orig +0 -9
@@ -695,10 +695,6 @@ static void cmd_read_b(char *pb, int cou
 			result = wait_drv_ready();
 		} while (result != 6 || result == 0x0E);
 
-		if (result != 6) {
-			cmd_end();
-			return;
-		}
 #ifdef GSCD_DEBUG
 		printk("LOC_191 ");
 #endif
@@ -763,11 +759,6 @@ static void cmd_read_w(char *pb, int cou
 			result = wait_drv_ready();
 		} while (result != 6 || result == 0x0E);
 
-		if (result != 6) {
-			cmd_end();
-			return;
-		}
-
 		for (i = 0; i < size; i++) {
 			/* na, hier muss ich noch mal drueber nachdenken */
 			*pb = inw(GSCDPORT(2));
#1 lore raw
Quoted 4 lines · Eric Sesterhenn

hi,

this fixes Coverity Bugs #21 and #22. In both cases the do { ... } while (result != 6 || result == 0x0E) just

This is completely wrong, and should be fixed too.

Either

	do { ... } while (result != 6)

is correct, or this is the result of a thinko, and it should be

	do { ... } while (result != 6 && result != 0x0E)

in which case your patch is incorrect.

Quoted 2 lines

finishes for result == 6, so the if(result != 6) doesnt make much sense.

Unless its presence is an indication of faulty logic in the while clause

Daniel K.