staging: mt7621-pinctrl: init *map to NULL for correct memory assignation
authorSergio Paracuellos <sergio.paracuellos@gmail.com>
Mon, 9 Jul 2018 04:52:45 +0000 (06:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Jul 2018 10:36:28 +0000 (12:36 +0200)
pinctrl_utils_reserve_map() calls krealloc() on *map. Because of this
*map need to be initialized to NULL before calling it.

Fixes: 62b6215c11ea ("staging: mt7621-pinctrl: make use of pinctrl_utils_reserve_map")
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c

index 7025942..c223ecb 100644 (file)
@@ -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++;
 
+       *map = NULL;
        ret = pinctrl_utils_reserve_map(pctrldev, map, &reserved_maps,
                                        num_maps, ngroups);
        if (ret) {