Skip to contentSkip to conversation

power: supply: bq25890: Fix enum conversion in bq25890_power_supply_set_property()

PATCH In review Nathan Chancellor 3 participants 3 messages Sep 12, 2022 – Sep 14, 2022 Power supply

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: supply: bq25890: Fix enum conversion in bq25890_power_supply_set_property()

Clang warns:

drivers/power/supply/bq25890_charger.c:625:40: error: implicit conversion from enumeration type 'enum bq25890_fields' to different enumeration type 'enum bq25890_table_ids' [-Werror,-Wenum-conversion]

                  lval = bq25890_find_idx(val->intval, F_IINLIM);
                         ~~~~~~~~~~~~~~~~              ^~~~~~~~

1 error generated.

Use the proper value from the right enumerated type, TBL_IINLIM, so there is no more implcit conversion. The numerical values of F_IINLIM and TBL_IINLIM happen to be the same so there is no change in behavior.

Fixes 4a4748f28b0b ("power: supply: bq25890: Add support for setting IINLIM")
---
 drivers/power/supply/bq25890_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/bq25890_charger.c +1 -1
index f5368be32843..e6bd60fef0f6 100644
@@ -622,7 +622,7 @@ static int bq25890_power_supply_set_property(struct power_supply *psy,
 
 	switch (psp) {
 	case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
-		lval = bq25890_find_idx(val->intval, F_IINLIM);
+		lval = bq25890_find_idx(val->intval, TBL_IINLIM);
 		return bq25890_field_write(bq, F_IINLIM, lval);
 	default:
 		return -EINVAL;

base-commit: f52c4d5f0bb486bc515b5f8a56130aea69fb29db

Signature · 1 line
2.37.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Nathan Chancellor

Clang warns:

drivers/power/supply/bq25890_charger.c:625:40: error: implicit conversion from enumeration type 'enum bq25890_fields' to different enumeration type 'enum bq25890_table_ids' [-Werror,-Wenum-conversion]

                   lval = bq25890_find_idx(val->intval, F_IINLIM);
                          ~~~~~~~~~~~~~~~~              ^~~~~~~~

1 error generated.

Quoted 7 lines

Use the proper value from the right enumerated type, TBL_IINLIM, so there is no more implcit conversion. The numerical values of F_IINLIM and TBL_IINLIM happen to be the same so there is no change in behavior.

Fixes 4a4748f28b0b ("power: supply: bq25890: Add support for setting IINLIM")

Thanks

#2 lore raw

Hi,

Quoted 12 lines · Marek Vasut
Quoted 11 lines · Nathan Chancellor

Clang warns:

drivers/power/supply/bq25890_charger.c:625:40: error: implicit conversion from enumeration type 'enum bq25890_fields' to different enumeration type 'enum bq25890_table_ids' [-Werror,-Wenum-conversion]

                   lval = bq25890_find_idx(val->intval, F_IINLIM);
                          ~~~~~~~~~~~~~~~~              ^~~~~~~~

1 error generated.

Use the proper value from the right enumerated type, TBL_IINLIM, so there is no more implcit conversion. The numerical values of F_IINLIM and TBL_IINLIM happen to be the same so there is no change in behavior.

Quoted 5 lines
Quoted 3 lines
Fixes 4a4748f28b0b ("power: supply: bq25890: Add support for setting IINLIM")

Thanks, queued.

-- Sebastian