Skip to contentSkip to conversation

ALSA: cs5535 - Fix an endianness conversion

PATCH In review Dan Carpenter 2 participants 2 messages Nov 20, 2011 – Nov 21, 2011

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

PATCH 1/1 ALSA: cs5535 - Fix an endianness conversion

desc->size is supposed to be a le16 type. On a big endian system the current code will set ->size to zero. We fixed a similar bug on the next line but missed this one.

---
This is a static checker bug. I haven't tested it.

sound/pci/cs5535audio/cs5535audio_pcm.c +1 -1
index e083122..dbf94b1 100644
@@ -148,7 +148,7 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au,
 		struct cs5535audio_dma_desc *desc  			&((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i];
 		desc->addr = cpu_to_le32(addr);
-		desc->size = cpu_to_le32(period_bytes);
+		desc->size = cpu_to_le16(period_bytes);
 		desc->ctlreserved = cpu_to_le16(PRD_EOP);
 		desc_addr += sizeof(struct cs5535audio_dma_desc);
 		addr += period_bytes;
#1 lore raw

At Sun, 20 Nov 2011 23:57:49 +0300,

Quoted 8 lines · Dan Carpenter

desc->size is supposed to be a le16 type. On a big endian system the current code will set ->size to zero. We fixed a similar bug on the next line but missed this one.

---
This is a static checker bug. I haven't tested it.

Obviously correct, so I applied it now.

thanks,

Takashi

Quoted 14 lines
sound/pci/cs5535audio/cs5535audio_pcm.c +1 -1
index e083122..dbf94b1 100644
@@ -148,7 +148,7 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au,
 		struct cs5535audio_dma_desc *desc =
 			&((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i];
 		desc->addr = cpu_to_le32(addr);
-		desc->size = cpu_to_le32(period_bytes);
+		desc->size = cpu_to_le16(period_bytes);
 		desc->ctlreserved = cpu_to_le16(PRD_EOP);
 		desc_addr += sizeof(struct cs5535audio_dma_desc);
 		addr += period_bytes;