]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
ALSA: i2c/cs8427: Fix int to char conversion
authorPhilipp Klocke <philipp97kl@gmail.com>
Thu, 18 Oct 2018 10:33:02 +0000 (12:33 +0200)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:20:51 +0000 (14:20 -0300)
BugLink: https://bugs.launchpad.net/bugs/1854975
[ Upstream commit eb7ebfa3c1989aa8e59d5e68ab3cddd7df1bfb27 ]

Compiling with clang yields the following warning:

sound/i2c/cs8427.c:140:31: warning: implicit conversion from 'int'
to 'char' changes value from 160 to -96 [-Wconstant-conversion]
    data[0] = CS8427_REG_AUTOINC | CS8427_REG_CORU_DATABUF;
            ~ ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

Because CS8427_REG_AUTOINC is defined as 128, it is too big for a
char field.
So change data from char to unsigned char, that it can hold the value.

This patch does not change the generated code.

Signed-off-by: Philipp Klocke <philipp97kl@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
sound/i2c/cs8427.c

index 7e21621e492a4b2c83e9f296d9f472a581eb97b2..7fd1b40008838919f07067a81df02e355e1819f0 100644 (file)
@@ -118,7 +118,7 @@ static int snd_cs8427_send_corudata(struct snd_i2c_device *device,
        struct cs8427 *chip = device->private_data;
        char *hw_data = udata ?
                chip->playback.hw_udata : chip->playback.hw_status;
-       char data[32];
+       unsigned char data[32];
        int err, idx;
 
        if (!memcmp(hw_data, ndata, count))