lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230810111914.204847-2-krzysztof.kozlowski@linaro.org>
Date:   Thu, 10 Aug 2023 13:19:13 +0200
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To:     Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>, linux-kernel@...r.kernel.org
Cc:     Andi Shyti <andi.shyti@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Subject: [PATCH 2/3] 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@...aro.org>
---
 drivers/regulator/max77857-regulator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/max77857-regulator.c b/drivers/regulator/max77857-regulator.c
index 44a510547318..145ad0281857 100644
--- a/drivers/regulator/max77857-regulator.c
+++ b/drivers/regulator/max77857-regulator.c
@@ -53,7 +53,7 @@ enum max77857_id {
 
 static bool max77857_volatile_reg(struct device *dev, unsigned int reg)
 {
-	enum max77857_id id = (enum max77857_id)dev_get_drvdata(dev);
+	enum max77857_id id = (uintptr_t)dev_get_drvdata(dev);
 
 	switch (id) {
 	case ID_MAX77831:
@@ -91,7 +91,7 @@ static int max77857_get_status(struct regulator_dev *rdev)
 
 static unsigned int max77857_get_mode(struct regulator_dev *rdev)
 {
-	enum max77857_id id = (enum max77857_id)rdev_get_drvdata(rdev);
+	enum max77857_id id = (uintptr_t)rdev_get_drvdata(rdev);
 	unsigned int regval;
 	int ret;
 
@@ -125,7 +125,7 @@ static unsigned int max77857_get_mode(struct regulator_dev *rdev)
 
 static int max77857_set_mode(struct regulator_dev *rdev, unsigned int mode)
 {
-	enum max77857_id id = (enum max77857_id)rdev_get_drvdata(rdev);
+	enum max77857_id id = (uintptr_t)rdev_get_drvdata(rdev);
 	unsigned int reg, val;
 
 	switch (id) {
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ