qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/sd/sdhci: free irq on exit
@ 2025-03-28  9:49 Zheng Huang
  2025-03-28 18:08 ` Philippe Mathieu-Daudé
  2025-03-31 11:20 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 3+ messages in thread
From: Zheng Huang @ 2025-03-28  9:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

Hi,

This patch fixes a memory leak bug in `sdhci_pci_realize()`. `s->irq` is
not freed in `sdhci_pci_exit()`.

Signed-off-by: Zheng Huang <hz1624917200@gmail.com>

---
 hw/sd/sdhci-pci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/sd/sdhci-pci.c b/hw/sd/sdhci-pci.c
index 5268c0dee5..f5296d58ca 100644
--- a/hw/sd/sdhci-pci.c
+++ b/hw/sd/sdhci-pci.c
@@ -18,6 +18,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/module.h"
+#include "hw/irq.h"
 #include "hw/qdev-properties.h"
 #include "hw/sd/sdhci.h"
 #include "sdhci-internal.h"
@@ -50,6 +51,7 @@ static void sdhci_pci_exit(PCIDevice *dev)
 
     sdhci_common_unrealize(s);
     sdhci_uninitfn(s);
+    qemu_free_irq(s->irq);
 }
 
 static void sdhci_pci_class_init(ObjectClass *klass, void *data)
-- 
2.34.1



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

* Re: [PATCH] hw/sd/sdhci: free irq on exit
  2025-03-28  9:49 [PATCH] hw/sd/sdhci: free irq on exit Zheng Huang
@ 2025-03-28 18:08 ` Philippe Mathieu-Daudé
  2025-03-31 11:20 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-28 18:08 UTC (permalink / raw)
  To: Zheng Huang, qemu-devel

On 28/3/25 10:49, Zheng Huang wrote:
> Hi,
> 
> This patch fixes a memory leak bug in `sdhci_pci_realize()`. `s->irq` is
> not freed in `sdhci_pci_exit()`.
> 
> Signed-off-by: Zheng Huang <hz1624917200@gmail.com>
> 
> ---
>   hw/sd/sdhci-pci.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/hw/sd/sdhci-pci.c b/hw/sd/sdhci-pci.c
> index 5268c0dee5..f5296d58ca 100644
> --- a/hw/sd/sdhci-pci.c
> +++ b/hw/sd/sdhci-pci.c
> @@ -18,6 +18,7 @@
>   #include "qemu/osdep.h"
>   #include "qapi/error.h"
>   #include "qemu/module.h"
> +#include "hw/irq.h"
>   #include "hw/qdev-properties.h"
>   #include "hw/sd/sdhci.h"
>   #include "sdhci-internal.h"
> @@ -50,6 +51,7 @@ static void sdhci_pci_exit(PCIDevice *dev)
>   

Better move the call here, do release in opposite order of alloc.

>       sdhci_common_unrealize(s);
>       sdhci_uninitfn(s);
> +    qemu_free_irq(s->irq);
>   }

Regardless:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



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

* Re: [PATCH] hw/sd/sdhci: free irq on exit
  2025-03-28  9:49 [PATCH] hw/sd/sdhci: free irq on exit Zheng Huang
  2025-03-28 18:08 ` Philippe Mathieu-Daudé
@ 2025-03-31 11:20 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-31 11:20 UTC (permalink / raw)
  To: Zheng Huang, qemu-devel

On 28/3/25 10:49, Zheng Huang wrote:
> Hi,
> 
> This patch fixes a memory leak bug in `sdhci_pci_realize()`. `s->irq` is
> not freed in `sdhci_pci_exit()`.
> 
> Signed-off-by: Zheng Huang <hz1624917200@gmail.com>
> 
> ---
>   hw/sd/sdhci-pci.c | 2 ++
>   1 file changed, 2 insertions(+)

Queued to hw-misc, thanks!


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

end of thread, other threads:[~2025-03-31 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-28  9:49 [PATCH] hw/sd/sdhci: free irq on exit Zheng Huang
2025-03-28 18:08 ` Philippe Mathieu-Daudé
2025-03-31 11:20 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).