mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -mm] ixj gcc 4.1 warning fix
@ 2006-05-10  2:55 Daniel Walker
  2006-05-10 10:40 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Walker @ 2006-05-10  2:55 UTC (permalink / raw)
  To: akpm; +Cc: eokerson, linux-kernel

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

Signed-Off-By: Daniel Walker <dwalker@mvista.com>

Index: linux-2.6.16/drivers/telephony/ixj.c
===================================================================
--- linux-2.6.16.orig/drivers/telephony/ixj.c
+++ 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;
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH -mm] ixj gcc 4.1 warning fix
  2006-05-10  2:55 [PATCH -mm] ixj gcc 4.1 warning fix Daniel Walker
@ 2006-05-10 10:40 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2006-05-10 10:40 UTC (permalink / raw)
  To: Daniel Walker; +Cc: akpm, eokerson, linux-kernel

On Maw, 2006-05-09 at 19:55 -0700, Daniel Walker wrote:
> 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
> 
> Signed-Off-By: Daniel Walker <dwalker@mvista.com>

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-05-10 10:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-10  2:55 [PATCH -mm] ixj gcc 4.1 warning fix Daniel Walker
2006-05-10 10:40 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®