ALSA: cs5535audio: Fix invalid endian conversion
authorTakashi Iwai <tiwai@suse.de>
Wed, 25 Jul 2018 15:59:26 +0000 (17:59 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 26 Jul 2018 06:23:45 +0000 (08:23 +0200)
One place in cs5535audio_build_dma_packets() does an extra conversion
via cpu_to_le32(); namely jmpprd_addr is passed to setup_prd() ops,
which writes the value via cs_writel().  That is, the callback does
the conversion by itself, and we don't need to convert beforehand.

This patch fixes that bogus conversion.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/cs5535audio/cs5535audio.h
sound/pci/cs5535audio/cs5535audio_pcm.c

index f4fcdf93f3c8ed15c77283bca997d36276e2434d..d84620a0c26c4b95017e186930804f145656d981 100644 (file)
@@ -67,9 +67,9 @@ struct cs5535audio_dma_ops {
 };
 
 struct cs5535audio_dma_desc {
-       u32 addr;
-       u16 size;
-       u16 ctlreserved;
+       __le32 addr;
+       __le16 size;
+       __le16 ctlreserved;
 };
 
 struct cs5535audio_dma {
index ee7065f6e162bb965a01ffac057360b33d13d3a7..326caec854e1089baedc9b91bd04c9134888478b 100644 (file)
@@ -158,8 +158,8 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au,
        lastdesc->addr = cpu_to_le32((u32) dma->desc_buf.addr);
        lastdesc->size = 0;
        lastdesc->ctlreserved = cpu_to_le16(PRD_JMP);
-       jmpprd_addr = cpu_to_le32(lastdesc->addr +
-                                 (sizeof(struct cs5535audio_dma_desc)*periods));
+       jmpprd_addr = (u32)dma->desc_buf.addr +
+               sizeof(struct cs5535audio_dma_desc) * periods;
 
        dma->substream = substream;
        dma->period_bytes = period_bytes;