diff mbox series

sun4u: fix assert when adding NICs which aren't the in-built model

Message ID 1508059309-28458-1-git-send-email-mark.cave-ayland@ilande.co.uk
State New
Headers show
Series sun4u: fix assert when adding NICs which aren't the in-built model | expand

Commit Message

Mark Cave-Ayland Oct. 15, 2017, 9:21 a.m. UTC
Commit 8d93297 introduced a bug whereby non-inbuilt NICs are realized before
setting the default MAC address causing an assert. Switch NIC creation
over from pci_create_simple() to pci_create() which works exactly the
same except omitting the realize as originally intended.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/sparc64/sun4u.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Artyom Tarasenko Oct. 18, 2017, 9:10 a.m. UTC | #1
On Sun, Oct 15, 2017 at 11:21 AM, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
> Commit 8d93297 introduced a bug whereby non-inbuilt NICs are realized before
> setting the default MAC address causing an assert. Switch NIC creation
> over from pci_create_simple() to pci_create() which works exactly the
> same except omitting the realize as originally intended.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>

> ---
>  hw/sparc64/sun4u.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index 2edd1cc..bf89252 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -490,10 +490,10 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
>                  memcpy(&macaddr, &nd->macaddr.a, sizeof(MACAddr));
>                  onboard_nic = true;
>              } else {
> -                pci_dev = pci_create_simple(pci_busB, -1, "sunhme");
> +                pci_dev = pci_create(pci_busB, -1, "sunhme");
>              }
>          } else {
> -            pci_dev = pci_create_simple(pci_busB, -1, nd->model);
> +            pci_dev = pci_create(pci_busB, -1, nd->model);
>          }
>
>          dev = &pci_dev->qdev;
> --
> 1.7.10.4
>
diff mbox series

Patch

diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 2edd1cc..bf89252 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -490,10 +490,10 @@  static void sun4uv_init(MemoryRegion *address_space_mem,
                 memcpy(&macaddr, &nd->macaddr.a, sizeof(MACAddr));
                 onboard_nic = true;
             } else {
-                pci_dev = pci_create_simple(pci_busB, -1, "sunhme");
+                pci_dev = pci_create(pci_busB, -1, "sunhme");
             }
         } else {
-            pci_dev = pci_create_simple(pci_busB, -1, nd->model);
+            pci_dev = pci_create(pci_busB, -1, nd->model);
         }
 
         dev = &pci_dev->qdev;