Skip to contentSkip to conversation

ASoC: fsl: Correct FSL_SAI_CR2_MSEL_MASK definition

PATCH In review Takashi Iwai 2 participants 3 messages Jun 3, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: fsl: Correct FSL_SAI_CR2_MSEL_MASK definition

The bit mask FSL_SAI_CR2_MSEL_MASK is defined as (0xff << 26) and this obviously overflows the 32bit integer. Also this clears other bits than the needed ones (FSL_SAI_CR2_MSEL_XXX) wrongly.

This patch fixes the definition only to mask bits 26 and 27.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=84351

---
 sound/soc/fsl/fsl_sai.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/fsl_sai.h +1 -1
index 34667209b607..0e33a17ddd01 100644
@@ -72,7 +72,7 @@
 
 /* SAI Transmit and Recieve Configuration 2 Register */
 #define FSL_SAI_CR2_SYNC	BIT(30)
-#define FSL_SAI_CR2_MSEL_MASK	(0xff << 26)
+#define FSL_SAI_CR2_MSEL_MASK	(0x03 << 26)
 #define FSL_SAI_CR2_MSEL_BUS	0
 #define FSL_SAI_CR2_MSEL_MCLK1	BIT(26)
 #define FSL_SAI_CR2_MSEL_MCLK2	BIT(27)
Signature · 1 line
2.4.2
reviewer
#1 lore raw

Hello Iwai-san,

Quoted 5 lines · Takashi Iwai

The bit mask FSL_SAI_CR2_MSEL_MASK is defined as (0xff << 26) and this obviously overflows the 32bit integer. Also this clears other bits than the needed ones (FSL_SAI_CR2_MSEL_XXX) wrongly.

This patch fixes the definition only to mask bits 26 and 27.

An identical fix was included in the Commit c3ecef21c3f26bf47 (ASoC: fsl_sai: add sai master mode support) by Zidan Wang. And it's already in the linux-next tree.

Thank you
Nicolin

Quoted 23 lines

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=84351

---
 sound/soc/fsl/fsl_sai.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/fsl_sai.h +1 -1
index 34667209b607..0e33a17ddd01 100644
@@ -72,7 +72,7 @@
 
 /* SAI Transmit and Recieve Configuration 2 Register */
 #define FSL_SAI_CR2_SYNC	BIT(30)
-#define FSL_SAI_CR2_MSEL_MASK	(0xff << 26)
+#define FSL_SAI_CR2_MSEL_MASK	(0x03 << 26)
 #define FSL_SAI_CR2_MSEL_BUS	0
 #define FSL_SAI_CR2_MSEL_MCLK1	BIT(26)
 #define FSL_SAI_CR2_MSEL_MCLK2	BIT(27)
Signature · 1 line
2.4.2
#2 lore raw

At Wed, 3 Jun 2015 11:47:15 -0700,

Quoted 8 lines · Nicolin Chen

Hello Iwai-san,

Quoted 4 lines · Takashi Iwai

The bit mask FSL_SAI_CR2_MSEL_MASK is defined as (0xff << 26) and this obviously overflows the 32bit integer. Also this clears other bits than the needed ones (FSL_SAI_CR2_MSEL_XXX) wrongly.

Quoted 5 lines
Quoted 1 line

This patch fixes the definition only to mask bits 26 and 27.

An identical fix was included in the Commit c3ecef21c3f26bf47 (ASoC: fsl_sai: add sai master mode support) by Zidan Wang. And it's already in the linux-next tree.

Ah good, thanks.
I hope I would have received pulls for ASoC changes more often...

Takashi

Quoted 28 lines

Thank you
Nicolin

Quoted 23 lines

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=84351

---
 sound/soc/fsl/fsl_sai.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/fsl_sai.h +1 -1
index 34667209b607..0e33a17ddd01 100644
@@ -72,7 +72,7 @@
 
 /* SAI Transmit and Recieve Configuration 2 Register */
 #define FSL_SAI_CR2_SYNC	BIT(30)
-#define FSL_SAI_CR2_MSEL_MASK	(0xff << 26)
+#define FSL_SAI_CR2_MSEL_MASK	(0x03 << 26)
 #define FSL_SAI_CR2_MSEL_BUS	0
 #define FSL_SAI_CR2_MSEL_MCLK1	BIT(26)
 #define FSL_SAI_CR2_MSEL_MCLK2	BIT(27)
Signature · 1 line
2.4.2