Skip to content

Commit

Permalink
ALSA: i2c/cs8427: Fix int to char conversion
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Philipp Klocke authored and Takashi Iwai committed Oct 18, 2018
1 parent f90afe7 commit eb7ebfa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/i2c/cs8427.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit eb7ebfa

Please sign in to comment.