• Daniel Kurtz's avatar
    regulator: tps6586x: silence pointer-to-int-cast · a70f0d02
    Daniel Kurtz authored
    of_regulator_match.driver_data is (void *).  tps6586x uses it to store an
    anonymous enum value (those TPS6586X_ID_ values).
    
    Later, it tries to extract the ID by casting directly to an int, which is a
    no-no ([-Wpointer-to-int-cast]):
    
    drivers/regulator/tps6586x-regulator.c: In function 'tps6586x_parse_regulator_dt':
    drivers/regulator/tps6586x-regulator.c:430:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       id = (int)tps6586x_matches[i].driver_data;
            ^
    
    Instead of casting to int, uintptr_t is better suited for receiving and
    comparing integers extracted from void *.  This is especially true on
    64-bit systems where sizeof(void *) != sizeof(int).
    Signed-off-by: default avatarDaniel Kurtz <djkurtz@chromium.org>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    a70f0d02
tps6586x-regulator.c 15.9 KB