diff mbox series

[10/17] e1000: Don't run e1000_instance_init() twice

Message ID 20200428163419.4483-11-armbru@redhat.com
State New
Headers show
Series qom: Spring cleaning | expand

Commit Message

Markus Armbruster April 28, 2020, 4:34 p.m. UTC
QOM object initialization runs .instance_init() for the type and all
its supertypes; see object_init_with_type().

Both TYPE_E1000_BASE and its concrete subtypes set .instance_init() to
e1000_instance_init().  For the concrete subtypes, it duly gets run
twice.  The second run fails, but the error gets ignored (a later
commit will change that).

Remove it from the subtypes.

Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/net/e1000.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Jason Wang April 29, 2020, 8:55 a.m. UTC | #1
On 2020/4/29 上午12:34, Markus Armbruster wrote:
> QOM object initialization runs .instance_init() for the type and all
> its supertypes; see object_init_with_type().
>
> Both TYPE_E1000_BASE and its concrete subtypes set .instance_init() to
> e1000_instance_init().  For the concrete subtypes, it duly gets run
> twice.  The second run fails, but the error gets ignored (a later
> commit will change that).
>
> Remove it from the subtypes.
>
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>


Acked-by: Jason Wang <jasowang@redhat.com>


> ---
>   hw/net/e1000.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/hw/net/e1000.c b/hw/net/e1000.c
> index 2a69eee63f..0d2c2759e3 100644
> --- a/hw/net/e1000.c
> +++ b/hw/net/e1000.c
> @@ -1824,7 +1824,6 @@ static void e1000_register_types(void)
>           type_info.parent = TYPE_E1000_BASE;
>           type_info.class_data = (void *)info;
>           type_info.class_init = e1000_class_init;
> -        type_info.instance_init = e1000_instance_init;
>   
>           type_register(&type_info);
>       }
diff mbox series

Patch

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 2a69eee63f..0d2c2759e3 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -1824,7 +1824,6 @@  static void e1000_register_types(void)
         type_info.parent = TYPE_E1000_BASE;
         type_info.class_data = (void *)info;
         type_info.class_init = e1000_class_init;
-        type_info.instance_init = e1000_instance_init;
 
         type_register(&type_info);
     }