Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933973AbbGVKXs (ORCPT ); Wed, 22 Jul 2015 06:23:48 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:36774 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933007AbbGVKXp (ORCPT ); Wed, 22 Jul 2015 06:23:45 -0400 From: Daniel Kurtz Cc: Daniel Kurtz , Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org (open list:VOLTAGE AND CURRENT REGULATOR FRAMEWORK) Subject: [PATCH] regulator/tps6586x: silence pointer-to-int-cast Date: Wed, 22 Jul 2015 18:23:26 +0800 Message-Id: <1437560607-1198-1-git-send-email-djkurtz@chromium.org> X-Mailer: git-send-email 2.4.3.573.g4eafbef To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1800 Lines: 47 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 --- drivers/regulator/tps6586x-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index 2852de0..9e9d220 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( return NULL; for (i = 0; i < num; i++) { - int id; + uintptr_t id; if (!tps6586x_matches[i].init_data) continue; pdata->reg_init_data[i] = tps6586x_matches[i].init_data; - id = (int)tps6586x_matches[i].driver_data; + id = (uintptr_t)tps6586x_matches[i].driver_data; if (id == TPS6586X_ID_SYS) sys_rail = pdata->reg_init_data[i]->constraints.name; -- 2.4.3.573.g4eafbef -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/