lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230515012930.946-1-liming.wu@jaguarmicro.com>
Date:   Mon, 15 May 2023 09:29:30 +0800
From:   liming.wu@...uarmicro.com
To:     will@...nel.org
Cc:     mark.rutland@....com, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, robin.murphy@....com,
        Liming Wu <liming.wu@...uarmicro.com>
Subject: [PATCH] perf/arm-cmn: fix compilation issue

From: Liming Wu <liming.wu@...uarmicro.com>

This patch is used to fix following compilation issue with legacy gcc
and define variables at the beginning of the function

error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
2098 |                 for (int p = 0; p < CMN_MAX_PORTS; p++)

Signed-off-by: Liming Wu <liming.wu@...uarmicro.com>
---
 drivers/perf/arm-cmn.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 47d359f72957..2299fcde5b4a 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -2009,8 +2009,11 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)
 	u16 child_count, child_poff;
 	u32 xp_offset[CMN_MAX_XPS];
 	u64 reg;
-	int i, j;
+	int i, j, p;
 	size_t sz;
+	void __iomem *xp_region;
+	struct arm_cmn_node *xp;
+	unsigned int xp_ports;
 
 	arm_cmn_init_node_info(cmn, rgn_offset, &cfg);
 	if (cfg.type != CMN_TYPE_CFG)
@@ -2067,9 +2070,9 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)
 	cmn->dns = dn;
 	cmn->dtms = dtm;
 	for (i = 0; i < cmn->num_xps; i++) {
-		void __iomem *xp_region = cmn->base + xp_offset[i];
-		struct arm_cmn_node *xp = dn++;
-		unsigned int xp_ports = 0;
+		xp_region = cmn->base + xp_offset[i];
+		xp = dn++;
+		xp_ports = 0;
 
 		arm_cmn_init_node_info(cmn, xp_offset[i], xp);
 		/*
@@ -2095,7 +2098,7 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)
 		 * from this, since in that case we will see at least one XP
 		 * with port 2 connected, for the HN-D.
 		 */
-		for (int p = 0; p < CMN_MAX_PORTS; p++)
+		for (p = 0; p < CMN_MAX_PORTS; p++)
 			if (arm_cmn_device_connect_info(cmn, xp, p))
 				xp_ports |= BIT(p);
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ