Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

regulator: max77857: Fix Wvoid-pointer-to-enum-cast warning

'id' is an enum, thus cast of pointer on 64-bit compile test with W=1
causes:

max77857-regulator.c:56:24: error: cast to smaller integer type 'enum max77857_id' from 'void *' [-Werror,-Wvoid-pointer-to-enum-cast]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230810111914.204847-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Krzysztof Kozlowski and committed by
Mark Brown
b29f42c6 fddc9bb6

+3 -3
+3 -3
drivers/regulator/max77857-regulator.c
··· 53 53 54 54 static bool max77857_volatile_reg(struct device *dev, unsigned int reg) 55 55 { 56 - enum max77857_id id = (enum max77857_id)dev_get_drvdata(dev); 56 + enum max77857_id id = (uintptr_t)dev_get_drvdata(dev); 57 57 58 58 switch (id) { 59 59 case ID_MAX77831: ··· 91 91 92 92 static unsigned int max77857_get_mode(struct regulator_dev *rdev) 93 93 { 94 - enum max77857_id id = (enum max77857_id)rdev_get_drvdata(rdev); 94 + enum max77857_id id = (uintptr_t)rdev_get_drvdata(rdev); 95 95 unsigned int regval; 96 96 int ret; 97 97 ··· 125 125 126 126 static int max77857_set_mode(struct regulator_dev *rdev, unsigned int mode) 127 127 { 128 - enum max77857_id id = (enum max77857_id)rdev_get_drvdata(rdev); 128 + enum max77857_id id = (uintptr_t)rdev_get_drvdata(rdev); 129 129 unsigned int reg, val; 130 130 131 131 switch (id) {