diff options
author | Sergio Paracuellos <sergio.paracuellos@gmail.com> | 2018-06-28 22:03:04 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-06 18:33:43 +0300 |
commit | 62b6215c11eade6938d3d25e18a3682ed3dfcb91 (patch) | |
tree | fd14b7719c5d37738ee5dd9ab493b3af0ebcc04b /drivers/staging/mt7621-pinctrl | |
parent | 4a1cf86bce6782a44c4a6c96e6e036e590099012 (diff) | |
download | linux-62b6215c11eade6938d3d25e18a3682ed3dfcb91.tar.xz |
staging: mt7621-pinctrl: make use of pinctrl_utils_reserve_map
Function rt2880_pinctrl_dt_node_to_map was using 'kzalloc' to
reserve map memory. There is a 'pinctrl_utils_reserve_map' to
do this function. Just use it.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/mt7621-pinctrl')
-rw-r--r-- | drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c index 65c6b5ad231b..8a196d357e0f 100644 --- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c +++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c @@ -113,7 +113,10 @@ static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrldev, struct pinctrl_map **map, unsigned int *num_maps) { + struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev); + int ret; int max_maps = 0; + unsigned int reserved_maps = 0; struct pinctrl_map *tmp; struct device_node *np; @@ -127,9 +130,12 @@ static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrldev, if (!max_maps) return max_maps; - *map = kcalloc(max_maps, sizeof(struct pinctrl_map), GFP_KERNEL); - if (!*map) - return -ENOMEM; + ret = pinctrl_utils_reserve_map(pctrldev, map, &reserved_maps, + num_maps, max_maps); + if (ret) { + dev_err(p->dev, "can't reserve map: %d\n", ret); + return ret; + } tmp = *map; |