diff mbox series

power: supply: ltc2941: Fix ptr to enum cast

Message ID 20201010065526.2466583-1-iskren.chernev@gmail.com
State Accepted
Commit 58d1620c4ded303b9d94fc68b23e5af1ec507de6
Headers show
Series power: supply: ltc2941: Fix ptr to enum cast | expand

Commit Message

Iskren Chernev Oct. 10, 2020, 6:55 a.m. UTC
clang complains about casting pointers to smaller enum types.

Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com>
---
 drivers/power/supply/ltc2941-battery-gauge.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


base-commit: 411643e949f4e616f758e2c6079f333b0e704c49

Comments

Sebastian Reichel Oct. 10, 2020, 11:30 p.m. UTC | #1
Hi,

On Sat, Oct 10, 2020 at 09:55:26AM +0300, Iskren Chernev wrote:
> clang complains about casting pointers to smaller enum types.
> 
> Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/ltc2941-battery-gauge.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/ltc2941-battery-gauge.c b/drivers/power/supply/ltc2941-battery-gauge.c
> index 30a9014b2f95e..10cd617516ec2 100644
> --- a/drivers/power/supply/ltc2941-battery-gauge.c
> +++ b/drivers/power/supply/ltc2941-battery-gauge.c
> @@ -473,7 +473,8 @@ static int ltc294x_i2c_probe(struct i2c_client *client,
>  
>  	np = of_node_get(client->dev.of_node);
>  
> -	info->id = (enum ltc294x_id)of_device_get_match_data(&client->dev);
> +	info->id = (enum ltc294x_id) (uintptr_t) of_device_get_match_data(
> +							&client->dev);
>  	info->supply_desc.name = np->name;
>  
>  	/* r_sense can be negative, when sense+ is connected to the battery
> 
> base-commit: 411643e949f4e616f758e2c6079f333b0e704c49
> -- 
> 2.28.0
>
diff mbox series

Patch

diff --git a/drivers/power/supply/ltc2941-battery-gauge.c b/drivers/power/supply/ltc2941-battery-gauge.c
index 30a9014b2f95e..10cd617516ec2 100644
--- a/drivers/power/supply/ltc2941-battery-gauge.c
+++ b/drivers/power/supply/ltc2941-battery-gauge.c
@@ -473,7 +473,8 @@  static int ltc294x_i2c_probe(struct i2c_client *client,
 
 	np = of_node_get(client->dev.of_node);
 
-	info->id = (enum ltc294x_id)of_device_get_match_data(&client->dev);
+	info->id = (enum ltc294x_id) (uintptr_t) of_device_get_match_data(
+							&client->dev);
 	info->supply_desc.name = np->name;
 
 	/* r_sense can be negative, when sense+ is connected to the battery