Skip to content
Snippets Groups Projects
  • Philipp Klocke's avatar
    eb7ebfa3
    ALSA: i2c/cs8427: Fix int to char conversion · eb7ebfa3
    Philipp Klocke authored
    
    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: default avatarPhilipp Klocke <philipp97kl@gmail.com>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    eb7ebfa3
    History
    ALSA: i2c/cs8427: Fix int to char conversion
    Philipp Klocke authored
    
    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: default avatarPhilipp Klocke <philipp97kl@gmail.com>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.