regulator: tps6586x: silence pointer-to-int-cast
authorDaniel Kurtz <djkurtz@chromium.org>
Wed, 22 Jul 2015 10:23:26 +0000 (18:23 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 23 Jul 2015 14:58:33 +0000 (15:58 +0100)
commita70f0d027c83350ad46ca3e86e4c781bfed7fcc2
treed1016bdb21837a1f740b856c544f980ff485ae29
parentbc0195aad0daa2ad5b0d76cce22b167bc3435590
regulator: tps6586x: silence pointer-to-int-cast

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: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/tps6586x-regulator.c
This page took 0.025752 seconds and 5 git commands to generate.