From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
qemu-arm@nongnu.org, Thomas Huth <thuth@redhat.com>
Subject: Re: [PATCH 01/10] hw/arm/realview: Simplify using 'break' statement
Date: Wed, 24 May 2023 12:00:58 -0700 [thread overview]
Message-ID: <78cc4cd6-f961-a271-6d00-b04d5a5732ff@linaro.org> (raw)
In-Reply-To: <20230524145906.33156-2-philmd@linaro.org>
On 5/24/23 07:58, Philippe Mathieu-Daudé wrote:
> The 'break' statement terminates the execution of the nearest
> enclosing 'for' statement in which it appears.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/arm/realview.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/hw/arm/realview.c b/hw/arm/realview.c
> index a5aa2f046a..a52ff35084 100644
> --- a/hw/arm/realview.c
> +++ b/hw/arm/realview.c
> @@ -88,7 +88,6 @@ static void realview_init(MachineState *machine,
> I2CBus *i2c;
> int n;
> unsigned int smp_cpus = machine->smp.cpus;
> - int done_nic = 0;
> qemu_irq cpu_irq[4];
> int is_mpcore = 0;
> int is_pb = 0;
> @@ -294,14 +293,13 @@ static void realview_init(MachineState *machine,
> for(n = 0; n < nb_nics; n++) {
> nd = &nd_table[n];
>
> - if (!done_nic && (!nd->model ||
> - strcmp(nd->model, is_pb ? "lan9118" : "smc91c111") == 0)) {
> + if (!nd->model || strcmp(nd->model, is_pb ? "lan9118" : "smc91c111") == 0) {
> if (is_pb) {
> lan9118_init(nd, 0x4e000000, pic[28]);
> } else {
> smc91c111_init(nd, 0x4e000000, pic[28]);
> }
> - done_nic = 1;
> + break;
While I agree this preserves existing behaviour, it doesn't seem like the logic is
actually correct. This will only ever connect 1 of nb_nics.
r~
> } else {
> if (pci_bus) {
> pci_nic_init_nofail(nd, pci_bus, "rtl8139", NULL);
next prev parent reply other threads:[~2023-05-24 19:01 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-24 14:58 [PATCH 00/10] hw/arm/realview: Introduce abstract RealviewMachineClass Philippe Mathieu-Daudé
2023-05-24 14:58 ` [PATCH 01/10] hw/arm/realview: Simplify using 'break' statement Philippe Mathieu-Daudé
2023-05-24 19:00 ` Richard Henderson [this message]
2023-05-25 12:43 ` Peter Maydell
2023-05-24 14:58 ` [PATCH 02/10] hw/arm/realview: Declare QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé
2023-05-24 19:01 ` Richard Henderson
2023-05-24 14:58 ` [PATCH 03/10] hw/arm/realview: Introduce abstract RealviewMachineClass Philippe Mathieu-Daudé
2023-05-24 19:04 ` Richard Henderson
2023-05-24 14:59 ` [PATCH 04/10] hw/arm/realview: Factor realview_common_class_init() out Philippe Mathieu-Daudé
2023-05-24 19:05 ` Richard Henderson
2023-05-24 14:59 ` [PATCH 05/10] hw/arm/realview: Move 'board_id' to RealviewMachineClass Philippe Mathieu-Daudé
2023-05-24 19:06 ` Richard Henderson
2023-05-24 14:59 ` [PATCH 06/10] hw/arm/realview: Move 'is_pb' " Philippe Mathieu-Daudé
2023-05-24 19:06 ` Richard Henderson
2023-05-24 14:59 ` [PATCH 07/10] hw/arm/realview: Move 'mpcore_periphbase' " Philippe Mathieu-Daudé
2023-05-24 19:10 ` Richard Henderson
2023-05-24 14:59 ` [PATCH 08/10] hw/arm/realview: Move 'loader_start' " Philippe Mathieu-Daudé
2023-05-24 19:10 ` Richard Henderson
2023-05-24 14:59 ` [PATCH 09/10] hw/arm/realview: Use generic realview_common_machine_init() Philippe Mathieu-Daudé
2023-05-24 19:12 ` Richard Henderson
2023-05-24 14:59 ` [PATCH 10/10] hw/arm/realview: Set MachineClass::default_nic in machine_class_init() Philippe Mathieu-Daudé
2023-05-24 19:13 ` Richard Henderson
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=78cc4cd6-f961-a271-6d00-b04d5a5732ff@linaro.org \
--to=richard.henderson@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/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).