All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] hw/ppc/ppc405_boards: Initialize g_autofree pointer
@ 2022-04-05 12:35 Bernhard Beschow
  2022-04-05 12:42 ` Peter Maydell
  2022-04-20 19:15 ` Daniel Henrique Barboza
  0 siblings, 2 replies; 3+ messages in thread
From: Bernhard Beschow @ 2022-04-05 12:35 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, open list:ppc4xx, Bernhard Beschow

Resolves the only compiler warning when building a full QEMU under Arch Linux:

  Compiling C object libqemu-ppc-softmmu.fa.p/hw_ppc_ppc405_boards.c.o
  In file included from /usr/include/glib-2.0/glib.h:114,
                   from qemu/include/glib-compat.h:32,
                   from qemu/include/qemu/osdep.h:132,
                   from ../src/hw/ppc/ppc405_boards.c:25:
  ../src/hw/ppc/ppc405_boards.c: In function ‘ref405ep_init’:
  /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: warning: ‘filename’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     28 |   g_free (*pp);
        |   ^~~~~~~~~~~~
  ../src/hw/ppc/ppc405_boards.c:265:26: note: ‘filename’ was declared here
    265 |         g_autofree char *filename;
        |                          ^~~~~~~~

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/ppc/ppc405_boards.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
index 7e1a4ac955..3bed7002d2 100644
--- a/hw/ppc/ppc405_boards.c
+++ b/hw/ppc/ppc405_boards.c
@@ -262,13 +262,13 @@ static void ref405ep_init(MachineState *machine)
     /* allocate and load BIOS */
     if (machine->firmware) {
         MemoryRegion *bios = g_new(MemoryRegion, 1);
-        g_autofree char *filename;
+        g_autofree char *filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
+                                                   machine->firmware);
         long bios_size;
 
         memory_region_init_rom(bios, NULL, "ef405ep.bios", BIOS_SIZE,
                                &error_fatal);
 
-        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware);
         if (!filename) {
             error_report("Could not find firmware '%s'", machine->firmware);
             exit(1);
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] hw/ppc/ppc405_boards: Initialize g_autofree pointer
  2022-04-05 12:35 [PATCH v2] hw/ppc/ppc405_boards: Initialize g_autofree pointer Bernhard Beschow
@ 2022-04-05 12:42 ` Peter Maydell
  2022-04-20 19:15 ` Daniel Henrique Barboza
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2022-04-05 12:42 UTC (permalink / raw)
  To: Bernhard Beschow; +Cc: qemu-trivial, open list:ppc4xx, qemu-devel

On Tue, 5 Apr 2022 at 13:40, Bernhard Beschow <shentey@gmail.com> wrote:
>
> Resolves the only compiler warning when building a full QEMU under Arch Linux:
>
>   Compiling C object libqemu-ppc-softmmu.fa.p/hw_ppc_ppc405_boards.c.o
>   In file included from /usr/include/glib-2.0/glib.h:114,
>                    from qemu/include/glib-compat.h:32,
>                    from qemu/include/qemu/osdep.h:132,
>                    from ../src/hw/ppc/ppc405_boards.c:25:
>   ../src/hw/ppc/ppc405_boards.c: In function ‘ref405ep_init’:
>   /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: warning: ‘filename’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>      28 |   g_free (*pp);
>         |   ^~~~~~~~~~~~
>   ../src/hw/ppc/ppc405_boards.c:265:26: note: ‘filename’ was declared here
>     265 |         g_autofree char *filename;
>         |                          ^~~~~~~~
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---

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

thanks
-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] hw/ppc/ppc405_boards: Initialize g_autofree pointer
  2022-04-05 12:35 [PATCH v2] hw/ppc/ppc405_boards: Initialize g_autofree pointer Bernhard Beschow
  2022-04-05 12:42 ` Peter Maydell
@ 2022-04-20 19:15 ` Daniel Henrique Barboza
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Henrique Barboza @ 2022-04-20 19:15 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel; +Cc: qemu-trivial, open list:ppc4xx

Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,


Daniel

On 4/5/22 09:35, Bernhard Beschow wrote:
> Resolves the only compiler warning when building a full QEMU under Arch Linux:
> 
>    Compiling C object libqemu-ppc-softmmu.fa.p/hw_ppc_ppc405_boards.c.o
>    In file included from /usr/include/glib-2.0/glib.h:114,
>                     from qemu/include/glib-compat.h:32,
>                     from qemu/include/qemu/osdep.h:132,
>                     from ../src/hw/ppc/ppc405_boards.c:25:
>    ../src/hw/ppc/ppc405_boards.c: In function ‘ref405ep_init’:
>    /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: warning: ‘filename’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>       28 |   g_free (*pp);
>          |   ^~~~~~~~~~~~
>    ../src/hw/ppc/ppc405_boards.c:265:26: note: ‘filename’ was declared here
>      265 |         g_autofree char *filename;
>          |                          ^~~~~~~~
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/ppc/ppc405_boards.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c
> index 7e1a4ac955..3bed7002d2 100644
> --- a/hw/ppc/ppc405_boards.c
> +++ b/hw/ppc/ppc405_boards.c
> @@ -262,13 +262,13 @@ static void ref405ep_init(MachineState *machine)
>       /* allocate and load BIOS */
>       if (machine->firmware) {
>           MemoryRegion *bios = g_new(MemoryRegion, 1);
> -        g_autofree char *filename;
> +        g_autofree char *filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
> +                                                   machine->firmware);
>           long bios_size;
>   
>           memory_region_init_rom(bios, NULL, "ef405ep.bios", BIOS_SIZE,
>                                  &error_fatal);
>   
> -        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, machine->firmware);
>           if (!filename) {
>               error_report("Could not find firmware '%s'", machine->firmware);
>               exit(1);


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-20 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 12:35 [PATCH v2] hw/ppc/ppc405_boards: Initialize g_autofree pointer Bernhard Beschow
2022-04-05 12:42 ` Peter Maydell
2022-04-20 19:15 ` Daniel Henrique Barboza

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.