Skip to contentSkip to conversation

ixj gcc 4.1 warning fix

PATCH In review Daniel Walker 2 participants 2 messages May 10, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ixj gcc 4.1 warning fix

Fixes the following warnings,

drivers/telephony/ixj.c: In function 'ixj_pstn_state':
drivers/telephony/ixj.c:4847: warning: 'bytes.high' may be used uninitialized in this function drivers/telephony/ixj.c: In function 'ixj_write_frame':
drivers/telephony/ixj.c:3448: warning: 'blankword.high' may be used uninitialized in this function drivers/telephony/ixj.c:3448: warning: 'blankword.low' may be used uninitialized in this function

drivers/telephony/ixj.c +4 -2
Index: linux-2.6.16/drivers/telephony/ixj.c
===================================================================
@@ -3445,7 +3445,7 @@ static void ixj_write_frame(IXJ *j)
 {
 	int cnt, frame_count, dly;
 	IXJ_WORD dat;
-	BYTES blankword;
+	BYTES blankword = { .high = 0, .low = 0};
 
 	frame_count = 0;
 	if(j->flags.cidplay) {
@@ -3503,6 +3503,7 @@ static void ixj_write_frame(IXJ *j)
 					blankword.low = blankword.high = 0x00;
 					break;
 				case PLAYBACK_MODE_8LINEAR_WSS:
+				default:
 					blankword.low = blankword.high = 0x80;
 					break;
 				}
@@ -4844,7 +4845,7 @@ static char daa_int_read(IXJ *j)
 static char daa_CR_read(IXJ *j, int cr)
 {
 	IXJ_WORD wdata;
-	BYTES bytes;
+	BYTES bytes = { .high = 0, .low = 0};
 
 	if (!SCI_Prepare(j))
 		return 0;
@@ -4860,6 +4861,7 @@ static char daa_CR_read(IXJ *j, int cr)
 		bytes.high = 0xB0 + cr;
 		break;
 	case SOP_PU_PULSEDIALING:
+	default:
 		bytes.high = 0xF0 + cr;
 		break;
 	}
#1 lore raw
Quoted 9 lines · Daniel Walker

Fixes the following warnings,

drivers/telephony/ixj.c: In function 'ixj_pstn_state':
drivers/telephony/ixj.c:4847: warning: 'bytes.high' may be used uninitialized in this function drivers/telephony/ixj.c: In function 'ixj_write_frame':
drivers/telephony/ixj.c:3448: warning: 'blankword.high' may be used uninitialized in this function drivers/telephony/ixj.c:3448: warning: 'blankword.low' may be used uninitialized in this function

No this is not a good idea either. The missing default case stuff is as far as I can see from inspection not neccessary. If anything you want to add

	default:
		BUG();

since those are impossible cases.

The unusued variables also appear to be just compiler confusion.