Function 'rt2880_pinctrl_dt_node_to_map' calls internally
'pinctrl_utils_reserve_map' which expects 'num_maps' to be initialized.
It does a memory allocation based on the value, and triggers the following
warning if is not properly set:
if (unlikely(order >= MAX_ORDER)) {
WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN));
return NULL;
}
Initialize it to zero to avoid this problem.
Fixes: e12a1a6e087b ("staging: mt7621-pinctrl: refactor
rt2880_pinctrl_dt_node_to_map function")
Reported-by: NeilBrown <[email protected]>
Tested-by: NeilBrown <[email protected]>
Signed-off-by: Sergio Paracuellos <[email protected]>
---
Changes v2:
- Collect Tested-by tags. See:
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2018-December/130259.html
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
index aa98fbb17013..b663ca43a525 100644
--- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
+++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
@@ -88,6 +88,7 @@ static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev
*pctrldev,
for_each_node_with_property(np_config, "group")
ngroups++;
+ *num_maps = 0;
*map = NULL;
ret = pinctrl_utils_reserve_map(pctrldev, map, &reserved_maps,
num_maps, ngroups);
--
2.19.1
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel