diff mbox series

[16/21] hw/net/can/versal: Prefer object_initialize_child over object_initialize

Message ID 20240216110313.17039-17-philmd@linaro.org
State New
Headers show
Series hw: More QDev cleanups | expand

Commit Message

Philippe Mathieu-Daudé Feb. 16, 2024, 11:03 a.m. UTC
When the QOM parent is available, prefer object_initialize_child()
over object_initialize(), since it create the parent relationship.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/net/can/xlnx-versal-canfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Francisco Iglesias Feb. 23, 2024, 11:06 a.m. UTC | #1
On 2024-02-16 12:03, Philippe Mathieu-Daudé wrote:
> When the QOM parent is available, prefer object_initialize_child()
> over object_initialize(), since it create the parent relationship.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>


> ---
>   hw/net/can/xlnx-versal-canfd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c
> index 47a14cfe63..f8e4bd75e4 100644
> --- a/hw/net/can/xlnx-versal-canfd.c
> +++ b/hw/net/can/xlnx-versal-canfd.c
> @@ -1900,7 +1900,7 @@ static int canfd_populate_regarray(XlnxVersalCANFDState *s,
>           int index = rae[i].addr / 4;
>           RegisterInfo *r = &s->reg_info[index];
>   
> -        object_initialize(r, sizeof(*r), TYPE_REGISTER);
> +        object_initialize_child(OBJECT(s), "reg[*]", r, TYPE_REGISTER);
>   
>           *r = (RegisterInfo) {
>               .data = &s->regs[index],
Pavel Pisa Feb. 23, 2024, 12:23 p.m. UTC | #2
On Friday 23 of February 2024 12:06:34 Francisco Iglesias wrote:
> On 2024-02-16 12:03, Philippe Mathieu-Daudé wrote:
> > When the QOM parent is available, prefer object_initialize_child()
> > over object_initialize(), since it create the parent relationship.
> >
> > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>

Reviewed-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
diff mbox series

Patch

diff --git a/hw/net/can/xlnx-versal-canfd.c b/hw/net/can/xlnx-versal-canfd.c
index 47a14cfe63..f8e4bd75e4 100644
--- a/hw/net/can/xlnx-versal-canfd.c
+++ b/hw/net/can/xlnx-versal-canfd.c
@@ -1900,7 +1900,7 @@  static int canfd_populate_regarray(XlnxVersalCANFDState *s,
         int index = rae[i].addr / 4;
         RegisterInfo *r = &s->reg_info[index];
 
-        object_initialize(r, sizeof(*r), TYPE_REGISTER);
+        object_initialize_child(OBJECT(s), "reg[*]", r, TYPE_REGISTER);
 
         *r = (RegisterInfo) {
             .data = &s->regs[index],