All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] power: supply: bq25890: Fix enum conversion in bq25890_power_supply_set_property()
@ 2022-09-12 14:15 Nathan Chancellor
  2022-09-12 18:11 ` Marek Vasut
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2022-09-12 14:15 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Hans de Goede, Marek Vasut, Nick Desaulniers, Tom Rix, linux-pm,
	linux-kernel, llvm, patches, 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.

Fixes: 4a4748f28b0b ("power: supply: bq25890: Add support for setting IINLIM")
Link: https://github.com/ClangBuiltLinux/linux/issues/1707
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/power/supply/bq25890_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index f5368be32843..e6bd60fef0f6 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -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
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] power: supply: bq25890: Fix enum conversion in bq25890_power_supply_set_property()
  2022-09-12 14:15 [PATCH -next] power: supply: bq25890: Fix enum conversion in bq25890_power_supply_set_property() Nathan Chancellor
@ 2022-09-12 18:11 ` Marek Vasut
  2022-09-14 10:56   ` Sebastian Reichel
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Vasut @ 2022-09-12 18:11 UTC (permalink / raw)
  To: Nathan Chancellor, Sebastian Reichel
  Cc: Hans de Goede, Nick Desaulniers, Tom Rix, linux-pm, linux-kernel,
	llvm, patches

On 9/12/22 16:15, Nathan Chancellor wrote:
> 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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1707
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Reviewed-by: Marek Vasut <marex@denx.de>

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] power: supply: bq25890: Fix enum conversion in bq25890_power_supply_set_property()
  2022-09-12 18:11 ` Marek Vasut
@ 2022-09-14 10:56   ` Sebastian Reichel
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2022-09-14 10:56 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Nathan Chancellor, Hans de Goede, Nick Desaulniers, Tom Rix,
	linux-pm, linux-kernel, llvm, patches

[-- Attachment #1: Type: text/plain, Size: 1043 bytes --]

Hi,

On Mon, Sep 12, 2022 at 08:11:59PM +0200, Marek Vasut wrote:
> On 9/12/22 16:15, Nathan Chancellor wrote:
> > 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")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1707
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> 
> Reviewed-by: Marek Vasut <marex@denx.de>

Thanks, queued.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-14 10:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12 14:15 [PATCH -next] power: supply: bq25890: Fix enum conversion in bq25890_power_supply_set_property() Nathan Chancellor
2022-09-12 18:11 ` Marek Vasut
2022-09-14 10:56   ` Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.