From: "Cédric Le Goater" <clg@kaod.org>
To: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Joel Stanley" <joel@jms.id.au>,
"Andrew Jeffery" <andrew@aj.id.au>,
"Markus Armbruster" <armbru@redhat.com>,
"Cédric Le Goater" <clg@kaod.org>
Subject: [PATCH 4/4] aspeed/timer: Clean up local variable shadowing
Date: Fri, 22 Sep 2023 17:59:24 +0200 [thread overview]
Message-ID: <20230922155924.1172019-5-clg@kaod.org> (raw)
In-Reply-To: <20230922155924.1172019-1-clg@kaod.org>
commit 8137355e850f ("aspeed/timer: Fix behaviour running Linux")
introduced a MAX() expression to calculate the next timer deadline :
return calculate_time(t, MAX(MAX(t->match[0], t->match[1]), 0));
The second MAX() is not necessary since the compared values are an
unsigned and 0. Simply remove it and fix warning :
../hw/timer/aspeed_timer.c: In function ‘calculate_next’:
../include/qemu/osdep.h:396:31: warning: declaration of ‘_a’ shadows a previous local [-Wshadow=compatible-local]
396 | typeof(1 ? (a) : (b)) _a = (a), _b = (b); \
| ^~
../hw/timer/aspeed_timer.c:170:12: note: in expansion of macro ‘MAX’
170 | next = MAX(MAX(calculate_match(t, 0), calculate_match(t, 1)), 0);
| ^~~
../hw/timer/aspeed_timer.c:170:16: note: in expansion of macro ‘MAX’
170 | next = MAX(MAX(calculate_match(t, 0), calculate_match(t, 1)), 0);
| ^~~
/home/legoater/work/qemu/qemu-aspeed.git/include/qemu/osdep.h:396:31: note: shadowed declaration is here
396 | typeof(1 ? (a) : (b)) _a = (a), _b = (b); \
| ^~
../hw/timer/aspeed_timer.c:170:12: note: in expansion of macro ‘MAX’
170 | next = MAX(MAX(calculate_match(t, 0), calculate_match(t, 1)), 0);
| ^~~
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/timer/aspeed_timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c
index 9c20b3d6ad8a..72161f07bbee 100644
--- a/hw/timer/aspeed_timer.c
+++ b/hw/timer/aspeed_timer.c
@@ -167,7 +167,7 @@ static uint64_t calculate_next(struct AspeedTimer *t)
qemu_set_irq(t->irq, t->level);
}
- next = MAX(MAX(calculate_match(t, 0), calculate_match(t, 1)), 0);
+ next = MAX(calculate_match(t, 0), calculate_match(t, 1));
t->start = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
return calculate_time(t, next);
--
2.41.0
next prev parent reply other threads:[~2023-09-22 16:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-22 15:59 [PATCH 0/4] aspeed: Clean up local variable shadowing Cédric Le Goater
2023-09-22 15:59 ` [PATCH 1/4] aspeed/i2c: " Cédric Le Goater
2023-09-22 18:22 ` Philippe Mathieu-Daudé
2023-09-27 2:38 ` Joel Stanley
2023-09-22 15:59 ` [PATCH 2/4] aspeed: " Cédric Le Goater
2023-09-22 18:23 ` Philippe Mathieu-Daudé
2023-09-23 6:34 ` Markus Armbruster
2023-09-23 7:10 ` Cédric Le Goater
2023-09-22 15:59 ` [PATCH 3/4] aspeed/i3c: Rename variable shadowing a local Cédric Le Goater
2023-09-22 18:28 ` Philippe Mathieu-Daudé
2023-09-25 6:29 ` Andrew Jeffery
2023-09-22 15:59 ` Cédric Le Goater [this message]
2023-09-22 18:32 ` [PATCH 4/4] aspeed/timer: Clean up local variable shadowing Philippe Mathieu-Daudé
2023-09-22 18:20 ` [PATCH 0/4] aspeed: " Philippe Mathieu-Daudé
2023-09-22 19:00 ` Cédric Le Goater
2023-09-23 7:13 ` Markus Armbruster
2023-09-25 16:28 ` Cédric Le Goater
2023-09-26 6:44 ` Markus Armbruster
2023-09-29 6:46 ` Markus Armbruster
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=20230922155924.1172019-5-clg@kaod.org \
--to=clg@kaod.org \
--cc=andrew@aj.id.au \
--cc=armbru@redhat.com \
--cc=joel@jms.id.au \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).