On Thu, Jun 07 2018, Sergio Paracuellos wrote: > 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@xxxxxxxxx> > --- > drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c > index a172b68..84494a1 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 = kzalloc(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); Unfortunately this is buggy. pinctrl_utils_reserve_map() calls krealloc() on *map. So we need to initialise *map = NULL; before calling it. Thanks, NeilBrown
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel