Skip to contentSkip to conversation

Fix Oops with ALSA OSS emulation on PPC (2.6.10-rc3)

PATCH New Takashi Iwai 1 participant 1 message Dec 22, 2004 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix Oops with ALSA OSS emulation on PPC (2.6.10-rc3)

Hi,

Ben finally found out the cause of Oops happening on ALSA OSS emulation with powermac driver. It's because of the sign of char.

The patch is simple as attached below.
Could you apply it to 2.6.10?

thanks,

--
Takashi Iwai <[email protected]> ALSA Developer - www.alsa-project.org

====

Summary: [ALSA] Fix Oops with ALSA OSS emulation on PPC

Fix suggested by Benjamin Herrenschmidt <[email protected]>

On architectures like PPC, char is handled as "unsigned char", thus the pcm_format_data table entries with -1 give a positive 255. This results in Oops with OSS-emulation on such architectures.

The patch simply adds the right signed/unsigned prefix to fix this problem.

sound/core/pcm_misc.c +7 -4
@@ -25,11 +25,14 @@
 #include <sound/pcm.h>
 #define SND_PCM_FORMAT_UNKNOWN (-1)
 
+/* NOTE: "signed" prefix must be given below since the default char is
+ *       unsigned on some architectures!
+ */
 struct pcm_format_data {
-	char width;	/* bit width */
-	char phys;	/* physical bit width */
-	char le;	/* 0 = big-endian, 1 = little-endian, -1 = others */
-	char signd;	/* 0 = unsigned, 1 = signed, -1 = others */
+	unsigned char width;	/* bit width */
+	unsigned char phys;	/* physical bit width */
+	signed char le;	/* 0 = big-endian, 1 = little-endian, -1 = others */
+	signed char signd;	/* 0 = unsigned, 1 = signed, -1 = others */
 	unsigned char silence[8];	/* silence data to fill */
 };