[PATCH] ARM: pxa: Fix a memory leak in pxa310_otg_exit()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When otg_ulpi_create() is called, 2 kzalloc() are performed.
Only one is freed in pxa310_otg_exit().

The second kzalloc() has been introduced in the commit in the Fixes: tag.

Add the missing kfree().

Fixes: 298b083cf9dd ("usb: otg: ulpi: Start using struct usb_otg")
Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
This patch is NOT compile tested (I never cross compile even if I've been
tolled many times that it was easy...)

Another solution is to use devm_otg_ulpi_create() and further simplify
arch/arm/mach-pxa/pxa3xx-ulpi.c.

This would remove the only caller of otg_ulpi_create() and could also
simplify drivers/usb/phy/phy-ulpi.[ch]
---
 arch/arm/mach-pxa/pxa3xx-ulpi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-pxa/pxa3xx-ulpi.c b/arch/arm/mach-pxa/pxa3xx-ulpi.c
index c29a7f0fa1b0..82b4e2706f86 100644
--- a/arch/arm/mach-pxa/pxa3xx-ulpi.c
+++ b/arch/arm/mach-pxa/pxa3xx-ulpi.c
@@ -229,6 +229,7 @@ static int pxa310_otg_init(struct pxa3xx_u2d_platform_data *pdata)
 
 static void pxa310_otg_exit(void)
 {
+	kfree(u2d->otg->otg);
 	kfree(u2d->otg);
 }
 #else
-- 
2.34.1




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux