linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator/mfd: fix pointer-to-int cast
@ 2018-10-02 21:07 Arnd Bergmann
  2018-10-03  5:39 ` Matti Vaittinen
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2018-10-02 21:07 UTC (permalink / raw)
  To: Mark Brown, Lee Jones
  Cc: Arnd Bergmann, Matti Vaittinen, Enric Balletbo i Serra, linux-kernel

gcc points out that a pointer is longer than an int on 64-bit
architectures, and that casting between the two may be dangerous:

drivers/mfd/rohm-bd718x7.c: In function 'bd718xx_i2c_probe':
drivers/mfd/rohm-bd718x7.c:101:23: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]

In this driver it is correct, we just need the right kind of cast
to avoid the warning.

Fixes: 494edd266b94 ("regulator/mfd: Support ROHM BD71847 power management IC")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mfd/rohm-bd718x7.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/rohm-bd718x7.c b/drivers/mfd/rohm-bd718x7.c
index 161c8aac6d86..e66d59190a82 100644
--- a/drivers/mfd/rohm-bd718x7.c
+++ b/drivers/mfd/rohm-bd718x7.c
@@ -98,7 +98,7 @@ static int bd718xx_i2c_probe(struct i2c_client *i2c,
 		return -ENOMEM;
 
 	bd718xx->chip_irq = i2c->irq;
-	bd718xx->chip_type = (unsigned int)
+	bd718xx->chip_type = (uintptr_t)
 				of_device_get_match_data(&i2c->dev);
 	bd718xx->dev = &i2c->dev;
 	dev_set_drvdata(&i2c->dev, bd718xx);
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-03  5:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02 21:07 [PATCH] regulator/mfd: fix pointer-to-int cast Arnd Bergmann
2018-10-03  5:39 ` Matti Vaittinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).