aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kurtz <djkurtz@chromium.org>2015-07-22 06:23:26 -0400
committerMark Brown <broonie@kernel.org>2015-07-23 10:58:33 -0400
commita70f0d027c83350ad46ca3e86e4c781bfed7fcc2 (patch)
treed1016bdb21837a1f740b856c544f980ff485ae29
parentbc0195aad0daa2ad5b0d76cce22b167bc3435590 (diff)
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>
-rw-r--r--drivers/regulator/tps6586x-regulator.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index 2852de05d64d..9e9d22038017 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -422,12 +422,12 @@ static struct tps6586x_platform_data *tps6586x_parse_regulator_dt(
422 return NULL; 422 return NULL;
423 423
424 for (i = 0; i < num; i++) { 424 for (i = 0; i < num; i++) {
425 int id; 425 uintptr_t id;
426 if (!tps6586x_matches[i].init_data) 426 if (!tps6586x_matches[i].init_data)
427 continue; 427 continue;
428 428
429 pdata->reg_init_data[i] = tps6586x_matches[i].init_data; 429 pdata->reg_init_data[i] = tps6586x_matches[i].init_data;
430 id = (int)tps6586x_matches[i].driver_data; 430 id = (uintptr_t)tps6586x_matches[i].driver_data;
431 if (id == TPS6586X_ID_SYS) 431 if (id == TPS6586X_ID_SYS)
432 sys_rail = pdata->reg_init_data[i]->constraints.name; 432 sys_rail = pdata->reg_init_data[i]->constraints.name;
433 433