Patchwork target-arm: use type_register() instead of type_register_static()

login
register
mail settings
Submitter Eduardo Habkost
Date Nov. 28, 2012, 7:20 p.m.
Message ID <1354130408-22625-1-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/202533/
State New
Headers show

Comments

Eduardo Habkost - Nov. 28, 2012, 7:20 p.m.
The type_register_static() interface is documented as:

  type_register_static:
  @info: The #TypeInfo of the new type.

  @info and all of the strings it points to should exist for the life
  time that the type is registered.

But cpu_register() uses a stack variable for the 'info' argument, so it
has to use type_register() instead of type_register_static().

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target-arm/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Peter Maydell - Nov. 28, 2012, 7:30 p.m.
On 28 November 2012 19:20, Eduardo Habkost <ehabkost@redhat.com> wrote:
> The type_register_static() interface is documented as:
>
>   type_register_static:
>   @info: The #TypeInfo of the new type.
>
>   @info and all of the strings it points to should exist for the life
>   time that the type is registered.
>
> But cpu_register() uses a stack variable for the 'info' argument, so it
> has to use type_register() instead of type_register_static().

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

though it seems a bit odd that we make this distinction in the
API even though type_register_static() just calls type_register()...

-- PMM
Peter Maydell - Dec. 4, 2012, 5:16 p.m.
On 28 November 2012 19:20, Eduardo Habkost <ehabkost@redhat.com> wrote:
> The type_register_static() interface is documented as:
>
>   type_register_static:
>   @info: The #TypeInfo of the new type.
>
>   @info and all of the strings it points to should exist for the life
>   time that the type is registered.
>
> But cpu_register() uses a stack variable for the 'info' argument, so it
> has to use type_register() instead of type_register_static().
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Thanks, applied to target-arm.next.

-- PMM

Patch

diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index b00f5fa..ac914d2 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -778,7 +778,7 @@  static void cpu_register(const ARMCPUInfo *info)
         .class_size = sizeof(ARMCPUClass),
     };
 
-    type_register_static(&type_info);
+    type_register(&type_info);
 }
 
 static const TypeInfo arm_cpu_type_info = {