Skip to contentSkip to conversation

bfin: check if an empty array pointer is passed to pinmux request API

PATCH New Sonic Zhang 1 participant 1 message Feb 5, 2015 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bfin: check if an empty array pointer is passed to pinmux request API

From: Sonic Zhang <[email protected]>

to avoid possible indigestion

---
 arch/blackfin/kernel/bfin_gpio.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/blackfin/kernel/bfin_gpio.c +4 -0
index a017359..153841f 100644
@@ -730,6 +730,8 @@ int peripheral_request_list(const unsigned short per[], const char *label)
 	u16 cnt;
 	int ret;
 
+	if (per == NULL)
+		return -ENODEV;
 	for (cnt = 0; per[cnt] != 0; cnt++) {
 
 		ret = peripheral_request(per[cnt], label);
@@ -778,6 +780,8 @@ EXPORT_SYMBOL(peripheral_free);
 void peripheral_free_list(const unsigned short per[])
 {
 	u16 cnt;
+	if (per == NULL)
+		return;
 	for (cnt = 0; per[cnt] != 0; cnt++)
 		peripheral_free(per[cnt]);
 }
Signature · 1 line
1.7.9.5