Skip to contentSkip to conversation

bus: mvebu-mbus: fix iounmap() in error path

PATCH In review Luis Henriques 2 participants 2 messages Nov 16, 2016 – Nov 18, 2016 Arm/Marvell Dove/MV78xx0/Orion SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus: mvebu-mbus: fix iounmap() in error path

This patch fixes the following Coccinelle error:

./drivers/bus/mvebu-mbus.c:1115:2-8: \
	ERROR: missing iounmap; ioremap on line 1108 \
	and execution via conditional on line 1113

Although all mvebu_mbus_common_init() callers seem to actually use &mbus_state in the 1st argument, this is still a bug that could be triggered by future changes.

---
 drivers/bus/mvebu-mbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mvebu-mbus.c +1 -1
index c7f396903184..449466eff56f 100644
@@ -1111,7 +1111,7 @@ static int __init mvebu_mbus_common_init(struct mvebu_mbus_state *mbus,
 
 	mbus->sdramwins_base = ioremap(sdramwins_phys_base, sdramwins_size);
 	if (!mbus->sdramwins_base) {
-		iounmap(mbus_state.mbuswins_base);
+		iounmap(mbus->mbuswins_base);
 		return -ENOMEM;
 	}
 
Acked-by on v1 1/1
#1 lore raw

Hi Luis,

Quoted 11 lines · Luis Henriques

This patch fixes the following Coccinelle error:

./drivers/bus/mvebu-mbus.c:1115:2-8: \
	ERROR: missing iounmap; ioremap on line 1108 \
	and execution via conditional on line 1113

Although all mvebu_mbus_common_init() callers seem to actually use &mbus_state in the 1st argument, this is still a bug that could be triggered by future changes.

and applied on mvebu/dt

Thanks,

Gregory

Quoted 17 lines
---
 drivers/bus/mvebu-mbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mvebu-mbus.c +1 -1
index c7f396903184..449466eff56f 100644
@@ -1111,7 +1111,7 @@ static int __init mvebu_mbus_common_init(struct mvebu_mbus_state *mbus,
 
 	mbus->sdramwins_base = ioremap(sdramwins_phys_base, sdramwins_size);
 	if (!mbus->sdramwins_base) {
-		iounmap(mbus_state.mbuswins_base);
+		iounmap(mbus->mbuswins_base);
 		return -ENOMEM;
 	}
 
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com