Linux Power Management development
 help / color / mirror / Atom feed
From: Phong Tran <tranmanphong@gmail.com>
To: sre@kernel.org
Cc: ndesaulniers@google.com, natechancellor@gmail.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	clang-built-linux@googlegroups.com,
	Phong Tran <tranmanphong@gmail.com>
Subject: [PATCH] power: supply: core: fix clang -Wunsequenced
Date: Thu,  2 May 2019 08:27:06 +0700	[thread overview]
Message-ID: <20190502012704.12505-1-tranmanphong@gmail.com> (raw)

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

             reply	other threads:[~2019-05-02  1:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-02  1:27 Phong Tran [this message]
2019-05-02  1:27 ` [PATCH] power: supply: core: fix clang -Wunsequenced Phong Tran
2019-05-02 18:00 ` Nick Desaulniers
2019-05-02 18:00   ` Nick Desaulniers
2019-05-02 20:15 ` Sebastian Reichel
2019-05-02 20:15   ` Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190502012704.12505-1-tranmanphong@gmail.com \
    --to=tranmanphong@gmail.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox