diff mbox series

[1/3] hw/nvram: Fix Memory Leak in Xilinx eFuse QOM

Message ID 20211015203532.2463705-2-tong.ho@xilinx.com
State New
Headers show
Series hw/nvram: Fix Memory Leaks in Xilinx eFUSE | expand

Commit Message

Tong Ho Oct. 15, 2021, 8:35 p.m. UTC
Signed-off-by: Tong Ho <tong.ho@xilinx.com>
---
 hw/nvram/xlnx-efuse.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Francisco Iglesias Oct. 18, 2021, 11:21 a.m. UTC | #1
On [2021 Oct 15] Fri 13:35:30, Tong Ho wrote:
> Signed-off-by: Tong Ho <tong.ho@xilinx.com>

Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>

> ---
>  hw/nvram/xlnx-efuse.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c
> index ee1caab54c..a0fd77b586 100644
> --- a/hw/nvram/xlnx-efuse.c
> +++ b/hw/nvram/xlnx-efuse.c
> @@ -144,10 +144,11 @@ static bool efuse_ro_bits_find(XlnxEFuse *s, uint32_t k)
>  bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit)
>  {
>      if (efuse_ro_bits_find(s, bit)) {
> +        g_autofree char *path = object_get_canonical_path(OBJECT(s));
> +
>          qemu_log_mask(LOG_GUEST_ERROR, "%s: WARN: "
>                        "Ignored setting of readonly efuse bit<%u,%u>!\n",
> -                      object_get_canonical_path(OBJECT(s)),
> -                      (bit / 32), (bit % 32));
> +                      path, (bit / 32), (bit % 32));
>          return false;
>      }
>  
> @@ -202,9 +203,11 @@ static void efuse_realize(DeviceState *dev, Error **errp)
>      efuse_ro_bits_sort(s);
>  
>      if ((s->efuse_size % 32) != 0) {
> +        g_autofree char *path = object_get_canonical_path(OBJECT(s));
> +
>          error_setg(errp,
>                     "%s.efuse-size: %u: property value not multiple of 32.",
> -                   object_get_canonical_path(OBJECT(dev)), s->efuse_size);
> +                   path, s->efuse_size);
>          return;
>      }
>  
> -- 
> 2.25.1
> 
>
diff mbox series

Patch

diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c
index ee1caab54c..a0fd77b586 100644
--- a/hw/nvram/xlnx-efuse.c
+++ b/hw/nvram/xlnx-efuse.c
@@ -144,10 +144,11 @@  static bool efuse_ro_bits_find(XlnxEFuse *s, uint32_t k)
 bool xlnx_efuse_set_bit(XlnxEFuse *s, unsigned int bit)
 {
     if (efuse_ro_bits_find(s, bit)) {
+        g_autofree char *path = object_get_canonical_path(OBJECT(s));
+
         qemu_log_mask(LOG_GUEST_ERROR, "%s: WARN: "
                       "Ignored setting of readonly efuse bit<%u,%u>!\n",
-                      object_get_canonical_path(OBJECT(s)),
-                      (bit / 32), (bit % 32));
+                      path, (bit / 32), (bit % 32));
         return false;
     }
 
@@ -202,9 +203,11 @@  static void efuse_realize(DeviceState *dev, Error **errp)
     efuse_ro_bits_sort(s);
 
     if ((s->efuse_size % 32) != 0) {
+        g_autofree char *path = object_get_canonical_path(OBJECT(s));
+
         error_setg(errp,
                    "%s.efuse-size: %u: property value not multiple of 32.",
-                   object_get_canonical_path(OBJECT(dev)), s->efuse_size);
+                   path, s->efuse_size);
         return;
     }