* [PATCH] power: supply: core: fix clang -Wunsequenced
@ 2019-05-02 1:27 Phong Tran
2019-05-02 18:00 ` Nick Desaulniers
2019-05-02 20:15 ` Sebastian Reichel
0 siblings, 2 replies; 3+ messages in thread
From: Phong Tran @ 2019-05-02 1:27 UTC (permalink / raw)
To: sre
Cc: ndesaulniers, natechancellor, linux-pm, linux-kernel,
clang-built-linux, Phong Tran
The increment operator of pointer in be32_to_cpu() is not explicitly.
It made the warning from clang:
drivers/power/supply/power_supply_core.c:674:36: error: multiple
unsequenced modifications to 'list' [-Werror,-Wunsequenced]
drivers/power/supply/power_supply_core.c:675:41: error: multiple
unsequenced modifications to 'list' [-Werror,-Wunsequenced]
Link: https://github.com/ClangBuiltLinux/linux/issues/460
Signed-off-by: Phong Tran <tranmanphong@gmail.com>
---
drivers/power/supply/power_supply_core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index c917a8b43b2b..7cc6f5fac0d0 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -665,8 +665,10 @@ int power_supply_get_battery_info(struct power_supply *psy,
}
for (i = 0; i < tab_len; i++) {
- table[i].ocv = be32_to_cpu(*list++);
- table[i].capacity = be32_to_cpu(*list++);
+ table[i].ocv = be32_to_cpu(*list);
+ list++;
+ table[i].capacity = be32_to_cpu(*list);
+ list++;
}
}
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] power: supply: core: fix clang -Wunsequenced
2019-05-02 1:27 [PATCH] power: supply: core: fix clang -Wunsequenced Phong Tran
@ 2019-05-02 18:00 ` Nick Desaulniers
2019-05-02 20:15 ` Sebastian Reichel
1 sibling, 0 replies; 3+ messages in thread
From: Nick Desaulniers @ 2019-05-02 18:00 UTC (permalink / raw)
To: Phong Tran; +Cc: sre, Nathan Chancellor, linux-pm, LKML, clang-built-linux
On Wed, May 1, 2019 at 6:28 PM Phong Tran <tranmanphong@gmail.com> wrote:
>
> The increment operator of pointer in be32_to_cpu() is not explicitly.
> It made the warning from clang:
>
> drivers/power/supply/power_supply_core.c:674:36: error: multiple
> unsequenced modifications to 'list' [-Werror,-Wunsequenced]
> drivers/power/supply/power_supply_core.c:675:41: error: multiple
> unsequenced modifications to 'list' [-Werror,-Wunsequenced]
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/460
>
> Signed-off-by: Phong Tran <tranmanphong@gmail.com>
> ---
> drivers/power/supply/power_supply_core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index c917a8b43b2b..7cc6f5fac0d0 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -665,8 +665,10 @@ int power_supply_get_battery_info(struct power_supply *psy,
> }
>
> for (i = 0; i < tab_len; i++) {
> - table[i].ocv = be32_to_cpu(*list++);
> - table[i].capacity = be32_to_cpu(*list++);
> + table[i].ocv = be32_to_cpu(*list);
> + list++;
> + table[i].capacity = be32_to_cpu(*list);
> + list++;
I prefer preincrement/predecrement to postincrement/postdecrement
unless absolutely necessary, but it really doesn't matter in this
case. Thanks for the patch.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] power: supply: core: fix clang -Wunsequenced
2019-05-02 1:27 [PATCH] power: supply: core: fix clang -Wunsequenced Phong Tran
2019-05-02 18:00 ` Nick Desaulniers
@ 2019-05-02 20:15 ` Sebastian Reichel
1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2019-05-02 20:15 UTC (permalink / raw)
To: Phong Tran
Cc: ndesaulniers, natechancellor, linux-pm, linux-kernel, clang-built-linux
[-- Attachment #1: Type: text/plain, Size: 1387 bytes --]
Hi,
On Thu, May 02, 2019 at 08:27:06AM +0700, Phong Tran wrote:
> The increment operator of pointer in be32_to_cpu() is not explicitly.
> It made the warning from clang:
>
> drivers/power/supply/power_supply_core.c:674:36: error: multiple
> unsequenced modifications to 'list' [-Werror,-Wunsequenced]
> drivers/power/supply/power_supply_core.c:675:41: error: multiple
> unsequenced modifications to 'list' [-Werror,-Wunsequenced]
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/460
>
> Signed-off-by: Phong Tran <tranmanphong@gmail.com>
> ---
Thanks, queued to power-supply's for-next branch.
-- Sebastian
> drivers/power/supply/power_supply_core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index c917a8b43b2b..7cc6f5fac0d0 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -665,8 +665,10 @@ int power_supply_get_battery_info(struct power_supply *psy,
> }
>
> for (i = 0; i < tab_len; i++) {
> - table[i].ocv = be32_to_cpu(*list++);
> - table[i].capacity = be32_to_cpu(*list++);
> + table[i].ocv = be32_to_cpu(*list);
> + list++;
> + table[i].capacity = be32_to_cpu(*list);
> + list++;
> }
> }
>
> --
> 2.21.0
>
[-- 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:[~2019-05-02 20:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-02 1:27 [PATCH] power: supply: core: fix clang -Wunsequenced Phong Tran
2019-05-02 18:00 ` Nick Desaulniers
2019-05-02 20:15 ` 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.