regulator/mfd: fix pointer-to-int cast
PATCH 1/1 regulator/mfd: fix pointer-to-int cast
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.
--- drivers/mfd/rohm-bd718x7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/rohm-bd718x7.c +1 -1
@@ -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);
Signature · 1 line
2.18.0
Hello Arnd,
Quoted 20 lines · Arnd Bergmann
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 <[email protected]>--- drivers/mfd/rohm-bd718x7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mfd/rohm-bd718x7.c +0
-0
drivers/mfd/rohm-bd718x7.c static int bd718xx_i2c_probe(struct i2c_client *i2c, · line 104
Quoted 8 lines
drivers/mfd/rohm-bd718x7.c +1
-1@@ -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);
Big thanks for this activity =) I also got heads up mail from linux-next so I also did a patch fixing this. I think Mark alrady applied that patch to his tree.
(https://lore.kernel.org/lkml/[email protected]/)
Br,
Matti Vaittinen