All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Joel Stanley" <joel@jms.id.au>,
	"Andrew Jeffery" <andrew@aj.id.au>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Francisco Iglesias" <frasse.iglesias@gmail.com>
Subject: [PATCH v2 02/12] aspeed: Introduce a boot_rom region at the machine level
Date: Wed,  7 Jun 2023 06:39:33 +0200	[thread overview]
Message-ID: <20230607043943.1837186-3-clg@kaod.org> (raw)
In-Reply-To: <20230607043943.1837186-1-clg@kaod.org>

This should also avoid Coverity to report a memory leak warning when
the QEMU process exits. See CID 1508061.

Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/arm/aspeed.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index bfc2070bd2ed..76a1e7303de1 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -40,6 +40,7 @@ struct AspeedMachineState {
     /* Public */
 
     AspeedSoCState soc;
+    MemoryRegion boot_rom;
     bool mmio_exec;
     char *fmc_model;
     char *spi_model;
@@ -275,15 +276,15 @@ static void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
  * Create a ROM and copy the flash contents at the expected address
  * (0x0). Boots faster than execute-in-place.
  */
-static void aspeed_install_boot_rom(AspeedSoCState *soc, BlockBackend *blk,
+static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk,
                                     uint64_t rom_size)
 {
-    MemoryRegion *boot_rom = g_new(MemoryRegion, 1);
+    AspeedSoCState *soc = &bmc->soc;
 
-    memory_region_init_rom(boot_rom, NULL, "aspeed.boot_rom", rom_size,
+    memory_region_init_rom(&bmc->boot_rom, NULL, "aspeed.boot_rom", rom_size,
                            &error_abort);
     memory_region_add_subregion_overlap(&soc->spi_boot_container, 0,
-                                        boot_rom, 1);
+                                        &bmc->boot_rom, 1);
     write_boot_rom(blk, ASPEED_SOC_SPI_BOOT_ADDR, rom_size, &error_abort);
 }
 
@@ -431,8 +432,7 @@ static void aspeed_machine_init(MachineState *machine)
 
         if (mtd0) {
             uint64_t rom_size = memory_region_size(&bmc->soc.spi_boot);
-            aspeed_install_boot_rom(&bmc->soc, blk_by_legacy_dinfo(mtd0),
-                                    rom_size);
+            aspeed_install_boot_rom(bmc, blk_by_legacy_dinfo(mtd0), rom_size);
         }
     }
 
-- 
2.40.1



  parent reply	other threads:[~2023-06-07  4:42 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07  4:39 [PATCH v2 00/12] aspeed: fixes and extensions Cédric Le Goater
2023-06-07  4:39 ` [PATCH v2 01/12] aspeed/hace: Initialize g_autofree pointer Cédric Le Goater
2023-06-07  7:53   ` Joel Stanley
2023-06-07  4:39 ` Cédric Le Goater [this message]
2023-06-07  8:04   ` [PATCH v2 02/12] aspeed: Introduce a boot_rom region at the machine level Joel Stanley
2023-06-07  4:39 ` [PATCH v2 03/12] aspeed: Use the boot_rom region of the fby35 machine Cédric Le Goater
2023-06-07  8:05   ` Joel Stanley
2023-06-29 10:57   ` Philippe Mathieu-Daudé
2023-06-07  4:39 ` [PATCH v2 04/12] hw/ssi: Add an "addr" property to SSIPeripheral Cédric Le Goater
2023-06-07  8:06   ` Joel Stanley
2023-06-07  8:28     ` Philippe Mathieu-Daudé
2023-06-07 14:15       ` Cédric Le Goater
2023-06-29 10:56         ` Philippe Mathieu-Daudé
2023-06-29 16:08           ` Cédric Le Goater
2023-06-07  4:39 ` [PATCH v2 05/12] hw/ssi: Introduce a ssi_get_cs() helper Cédric Le Goater
2023-06-07  8:10   ` Joel Stanley
2023-06-29 11:09   ` Philippe Mathieu-Daudé
2023-06-29 16:07     ` Cédric Le Goater
2023-06-07  4:39 ` [PATCH v2 06/12] aspeed/smc: Wire CS lines at reset Cédric Le Goater
2023-06-07 10:49   ` Joel Stanley
2023-06-07 17:05     ` Cédric Le Goater
2023-06-29 14:46   ` Cédric Le Goater
2023-06-07  4:39 ` [PATCH v2 07/12] hw/ssi: Check for duplicate addresses Cédric Le Goater
2023-06-07 10:52   ` Joel Stanley
2023-06-07  4:39 ` [PATCH v2 08/12] aspeed: Create flash devices only when defaults are enabled Cédric Le Goater
2023-06-07  4:39 ` [PATCH v2 09/12] m25p80: Introduce an helper to retrieve the BlockBackend of a device Cédric Le Goater
2023-06-07 10:55   ` Joel Stanley
2023-06-07  4:39 ` [PATCH v2 10/12] aspeed: Get the BlockBackend of FMC0 from the flash device Cédric Le Goater
2023-06-07 10:55   ` Joel Stanley
2023-06-07  4:39 ` [PATCH v2 11/12] aspeed: Introduce a "bmc-console" machine option Cédric Le Goater
2023-06-07 10:58   ` Joel Stanley
2023-06-07  4:39 ` [PATCH v2 12/12] target/arm: Allow users to set the number of VFP registers Cédric Le Goater
2023-06-07 11:06   ` Joel Stanley
2023-06-07 14:19     ` Cédric Le Goater
2023-06-08 10:19   ` Peter Maydell
2023-06-19 12:47   ` Mads Ynddal
2023-06-19 13:09     ` Cédric Le Goater
2023-06-19 13:46       ` Mads Ynddal
2023-06-19 13:41     ` Peter Maydell
2023-06-19 13:54       ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230607043943.1837186-3-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=andrew@aj.id.au \
    --cc=frasse.iglesias@gmail.com \
    --cc=joel@jms.id.au \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.