diff options
author | Devendra Naga <devendra.aaru@gmail.com> | 2012-06-08 15:22:11 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-06-12 07:35:32 -0400 |
commit | 3a86a5f8abb33956446ae31b1e9c149d7b2d1d21 (patch) | |
tree | e5a6c3a69c7b8e3e67b9d45fc2ee4aab9f47e790 /drivers/pinctrl/pinctrl-imx.c | |
parent | e85bbc19d5a9ad2b48bf8f2fd3277d6fe58f23ce (diff) |
pinctrl: pinctrl-imx: free allocated pinctrl_map structure only once and use kernel facilities for IMX_PMX_DUMP
a) as we allocate the pinctrl_map structure at imx_dt_node_to_map at line 167, anyway
if its an element, or a num_elements * (sizeof(type)) elements allocated to one single
pointer must be freed only once.
CASE. A)
as new_map is not moved and allocated like,
for (i = 0; i < MAX_ELEMS; i++) {
new_map[i] = kmalloc(numelems * size, GFP_KERNEL);
}
its freed as
for (i = 0; i < MAX_ELEMS; i++) {
kfree(new_map[i]);
}
CASE. B)
and its allocated like
new_map = kmalloc(numelems * size, GFP_KERNEL);
it just needs kfree not as case A's.
b) use KERN_DEBUG facility for the IMX_PMX_DUMP macro.
Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Acked-by: Dong Aisheng <dong.aisheng@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-imx.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-imx.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c index f6e7c670906c..09f3a3083540 100644 --- a/drivers/pinctrl/pinctrl-imx.c +++ b/drivers/pinctrl/pinctrl-imx.c | |||
@@ -27,16 +27,16 @@ | |||
27 | #include "core.h" | 27 | #include "core.h" |
28 | #include "pinctrl-imx.h" | 28 | #include "pinctrl-imx.h" |
29 | 29 | ||
30 | #define IMX_PMX_DUMP(info, p, m, c, n) \ | 30 | #define IMX_PMX_DUMP(info, p, m, c, n) \ |
31 | { \ | 31 | { \ |
32 | int i, j; \ | 32 | int i, j; \ |
33 | printk("Format: Pin Mux Config\n"); \ | 33 | printk(KERN_DEBUG "Format: Pin Mux Config\n"); \ |
34 | for (i = 0; i < n; i++) { \ | 34 | for (i = 0; i < n; i++) { \ |
35 | j = p[i]; \ | 35 | j = p[i]; \ |
36 | printk("%s %d 0x%lx\n", \ | 36 | printk(KERN_DEBUG "%s %d 0x%lx\n", \ |
37 | info->pins[j].name, \ | 37 | info->pins[j].name, \ |
38 | m[i], c[i]); \ | 38 | m[i], c[i]); \ |
39 | } \ | 39 | } \ |
40 | } | 40 | } |
41 | 41 | ||
42 | /* The bits in CONFIG cell defined in binding doc*/ | 42 | /* The bits in CONFIG cell defined in binding doc*/ |
@@ -201,10 +201,7 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
201 | static void imx_dt_free_map(struct pinctrl_dev *pctldev, | 201 | static void imx_dt_free_map(struct pinctrl_dev *pctldev, |
202 | struct pinctrl_map *map, unsigned num_maps) | 202 | struct pinctrl_map *map, unsigned num_maps) |
203 | { | 203 | { |
204 | int i; | 204 | kfree(map); |
205 | |||
206 | for (i = 0; i < num_maps; i++) | ||
207 | kfree(map); | ||
208 | } | 205 | } |
209 | 206 | ||
210 | static struct pinctrl_ops imx_pctrl_ops = { | 207 | static struct pinctrl_ops imx_pctrl_ops = { |
@@ -475,9 +472,8 @@ static int __devinit imx_pinctrl_parse_groups(struct device_node *np, | |||
475 | grp->configs[j] = config & ~IMX_PAD_SION; | 472 | grp->configs[j] = config & ~IMX_PAD_SION; |
476 | } | 473 | } |
477 | 474 | ||
478 | #ifdef DEBUG | ||
479 | IMX_PMX_DUMP(info, grp->pins, grp->mux_mode, grp->configs, grp->npins); | 475 | IMX_PMX_DUMP(info, grp->pins, grp->mux_mode, grp->configs, grp->npins); |
480 | #endif | 476 | |
481 | return 0; | 477 | return 0; |
482 | } | 478 | } |
483 | 479 | ||