linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] m68k/PCI: Fix a memory leak in an error handling path
@ 2020-04-18 20:00 Markus Elfring
  2020-04-18 20:55 ` Christophe JAILLET
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2020-04-18 20:00 UTC (permalink / raw)
  To: Christophe Jaillet, linux-m68k
  Cc: kernel-janitors, linux-kernel, Bjorn Helgaas, Geert Uytterhoeven,
	Greg Ungerer, Lorenzo Pieralisi

> If 'ioremap' fails, we must free 'bridge', as done in other error handling
> path bellow.

I suggest to improve this change description.

* Please avoid a typo.

* Is an imperative wording preferred?


…
> +++ b/arch/m68k/coldfire/pci.c
> @@ -216,8 +216,10 @@ static int __init mcf_pci_init(void)
…

I propose to move the pci_free_host_bridge() call for the desired
exception handling to the end of this function implementation.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=c0d73a868d9b411bd2d0c8e5ff9d98bfa8563cb1#n450

Regards,
Markus

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH] m68k/PCI: Fix a memory leak in an error handling path
@ 2020-04-18  7:07 Christophe JAILLET
  2020-04-20  7:08 ` Geert Uytterhoeven
  2020-04-21  7:12 ` Greg Ungerer
  0 siblings, 2 replies; 5+ messages in thread
From: Christophe JAILLET @ 2020-04-18  7:07 UTC (permalink / raw)
  To: gerg, geert, bhelgaas, lorenzo.pieralisi
  Cc: linux-m68k, linux-kernel, kernel-janitors, Christophe JAILLET

If 'ioremap' fails, we must free 'bridge', as done in other error handling
path bellow.

Fixes: 19cc4c843f40 ("m68k/PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 arch/m68k/coldfire/pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index 62b0eb6cf69a..84eab0f5e00a 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -216,8 +216,10 @@ static int __init mcf_pci_init(void)
 
 	/* Keep a virtual mapping to IO/config space active */
 	iospace = (unsigned long) ioremap(PCI_IO_PA, PCI_IO_SIZE);
-	if (iospace == 0)
+	if (iospace == 0) {
+		pci_free_host_bridge(bridge);
 		return -ENODEV;
+	}
 	pr_info("Coldfire: PCI IO/config window mapped to 0x%x\n",
 		(u32) iospace);
 
-- 
2.20.1


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

end of thread, other threads:[~2020-04-21  7:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18 20:00 [PATCH] m68k/PCI: Fix a memory leak in an error handling path Markus Elfring
2020-04-18 20:55 ` Christophe JAILLET
  -- strict thread matches above, loose matches on Subject: below --
2020-04-18  7:07 Christophe JAILLET
2020-04-20  7:08 ` Geert Uytterhoeven
2020-04-21  7:12 ` Greg Ungerer

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).