Skip to contentSkip to conversation

Few misc patches for v2.6.38 merge window

PATCH New Tony Lindgren 1 participant 6 messages Dec 4, 2010

Subsystems (3)
lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

cover Few misc patches for v2.6.38 merge window

Hi,

Here are some misc patches for review.

Regards,

Tony

---

Evgeny Kuznetsov (1):
omap: Ptr "isr_reg" tracked as NULL was dereferenced

Jarkko Nikula (1):
omap: McBSP: Fix potential memory leak in omap_mcbsp_remove

Shubhrajyoti D (1):
omap: McBSP: Make the free variable update more readable

Tony Lindgren (2):
Fix undefined reference to omap2_i2c_mux_pins
omap: Don't select mux by default for each board

 arch/arm/mach-omap2/Kconfig |    4 ----
 arch/arm/plat-omap/gpio.c   |    5 +++++
 arch/arm/plat-omap/i2c.c    |    7 +++++++
 arch/arm/plat-omap/mcbsp.c  |   16 +++++-----------
 4 files changed, 17 insertions(+), 15 deletions(-)
Signature · 1 line
Signature
author maintainer
#1 lore raw

PATCH 1/5 Fix undefined reference to omap2_i2c_mux_pins

In some cases we can get error function `omap2_i2c_add_bus':
arch/arm/plat-omap/i2c.c:136: undefined reference to omap2_i2c_mux_pins' arch/arm/plat-omap/i2c.c:141: undefined reference to omap_hwmod_lookup' arch/arm/plat-omap/i2c.c:157: undefined reference to `omap_device_build'

---
 arch/arm/plat-omap/i2c.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/plat-omap/i2c.c +7 -0
index a5bff9c..21fc937 100644
@@ -125,6 +125,7 @@ static struct omap_device_pm_latency omap_i2c_latency[] = {
 	},
 };
 
+#ifdef CONFIG_ARCH_OMAP2PLUS
 static inline int omap2_i2c_add_bus(int bus_id)
 {
 	int l;
@@ -161,6 +162,12 @@ static inline int omap2_i2c_add_bus(int bus_id)
 
 	return PTR_ERR(od);
 }
+#else
+static inline int omap2_i2c_add_bus(int bus_id)
+{
+	return 0;
+}
+#endif
 
 static int __init omap_i2c_add_bus(int bus_id)
 {
author maintainer
#2 lore raw

PATCH 2/5 omap: Ptr "isr_reg" tracked as NULL was dereferenced

In reply to Tony Lindgren

From: Evgeny Kuznetsov <[email protected]>

Value of "isr_reg" pointer is depend on configuration and GPIO method. Potentially it may have NULL value and it is dereferenced later in code. Warning and exit from function are added in this case.

---
 arch/arm/plat-omap/gpio.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/plat-omap/gpio.c +5 -0
index 28d28e4..28106b4 100644
@@ -1171,6 +1171,10 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 	if (bank->method == METHOD_GPIO_44XX)
 		isr_reg = bank->base + OMAP4_GPIO_IRQSTATUS0;
 #endif
+
+	if (WARN_ON(!isr_reg))
+		goto exit;
+
 	while(1) {
 		u32 isr_saved, level_mask = 0;
 		u32 enabled;
@@ -1230,6 +1234,7 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 	configured, we must unmask the bank interrupt only after
 	handler(s) are executed in order to avoid spurious bank
 	interrupt */
+exit:
 	if (!unmasked)
 		desc->chip->unmask(irq);
 
author maintainer
#3 lore raw

PATCH 3/5 omap: McBSP: Fix potential memory leak in omap_mcbsp_remove

In reply to Tony Lindgren

From: Jarkko Nikula <[email protected]>

Function omap_mcbsp_probe allocates struct omap_mcbsp *mcbsp but it is not freed in omap_mcbsp_remove. Fix this, remove unneeded structure cleanups and clk_disable calls since they are not needed here.

This is not problem currently but becomes if the mcbsp driver is ever modularized.

---
 arch/arm/plat-omap/mcbsp.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
arch/arm/plat-omap/mcbsp.c +1 -7
index eac4b97..f79090c 100644
@@ -1836,17 +1836,11 @@ static int __devexit omap_mcbsp_remove(struct platform_device *pdev)
 
 		omap34xx_device_exit(mcbsp);
 
-		clk_disable(mcbsp->fclk);
-		clk_disable(mcbsp->iclk);
 		clk_put(mcbsp->fclk);
 		clk_put(mcbsp->iclk);
 
 		iounmap(mcbsp->io_base);
-
-		mcbsp->fclk = NULL;
-		mcbsp->iclk = NULL;
-		mcbsp->free = 0;
-		mcbsp->dev = NULL;
+		kfree(mcbsp);
 	}
 
 	return 0;
author maintainer
#4 lore raw

PATCH 4/5 omap: McBSP: Make the free variable update more readable

In reply to Tony Lindgren

From: Shubhrajyoti D <[email protected]>

Using true/false instead of 1/0 to update the free variable.

---
 arch/arm/plat-omap/mcbsp.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/plat-omap/mcbsp.c +4 -4
index f79090c..fdecd33 100644
@@ -755,7 +755,7 @@ int omap_mcbsp_request(unsigned int id)
 		goto err_kfree;
 	}
 
-	mcbsp->free = 0;
+	mcbsp->free = false;
 	mcbsp->reg_cache = reg_cache;
 	spin_unlock(&mcbsp->lock);
 
@@ -815,7 +815,7 @@ err_clk_disable:
 	clk_disable(mcbsp->iclk);
 
 	spin_lock(&mcbsp->lock);
-	mcbsp->free = 1;
+	mcbsp->free = true;
 	mcbsp->reg_cache = NULL;
 err_kfree:
 	spin_unlock(&mcbsp->lock);
@@ -858,7 +858,7 @@ void omap_mcbsp_free(unsigned int id)
 	if (mcbsp->free)
 		dev_err(mcbsp->dev, "McBSP%d was not reserved\n", mcbsp->id);
 	else
-		mcbsp->free = 1;
+		mcbsp->free = true;
 	mcbsp->reg_cache = NULL;
 	spin_unlock(&mcbsp->lock);
 
@@ -1771,7 +1771,7 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
 
 	spin_lock_init(&mcbsp->lock);
 	mcbsp->id = id + 1;
-	mcbsp->free = 1;
+	mcbsp->free = true;
 	mcbsp->dma_tx_lch = -1;
 	mcbsp->dma_rx_lch = -1;
 
author maintainer
#5 lore raw

PATCH 5/5 omap: Don't select mux by default for each board

In reply to Tony Lindgren

This should be only selected in CONFIG_ARCH_OMAP2PLUS_TYPICAL to make it easy to disable.

---
 arch/arm/mach-omap2/Kconfig |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/Kconfig +0 -4
index fc3a181..144e7bb 100644
@@ -134,7 +134,6 @@ config MACH_DEVKIT8000
 	depends on ARCH_OMAP3
 	default y
 	select OMAP_PACKAGE_CUS
-	select OMAP_MUX
 
 config MACH_OMAP_LDP
 	bool "OMAP3 LDP board"
@@ -250,14 +249,12 @@ config MACH_CM_T35
 	depends on ARCH_OMAP3
 	default y
 	select OMAP_PACKAGE_CUS
-	select OMAP_MUX
 
 config MACH_CM_T3517
 	bool "CompuLab CM-T3517 module"
 	depends on ARCH_OMAP3
 	default y
 	select OMAP_PACKAGE_CBB
-	select OMAP_MUX
 
 config MACH_IGEP0020
 	bool "IGEP v2 board"
@@ -276,7 +273,6 @@ config MACH_SBC3530
 	depends on ARCH_OMAP3
 	default y
 	select OMAP_PACKAGE_CUS
-	select OMAP_MUX
 
 config MACH_OMAP_3630SDP
 	bool "OMAP3630 SDP board"