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>
	
	
This commit is contained in:
		
					parent
					
						
							
								e85bbc19d5
							
						
					
				
			
			
				commit
				
					
						3a86a5f8ab
					
				
			
		
					 1 changed files with 12 additions and 16 deletions
				
			
		|  | @ -30,10 +30,10 @@ | ||||||
| #define IMX_PMX_DUMP(info, p, m, c, n)			\ | #define IMX_PMX_DUMP(info, p, m, c, n)			\ | ||||||
| {							\ | {							\ | ||||||
| 	int i, j;					\ | 	int i, j;					\ | ||||||
| 	printk("Format: Pin Mux Config\n");	\ | 	printk(KERN_DEBUG "Format: Pin Mux Config\n");	\ | ||||||
| 	for (i = 0; i < n; i++) {			\ | 	for (i = 0; i < n; i++) {			\ | ||||||
| 		j = p[i];				\ | 		j = p[i];				\ | ||||||
| 		printk("%s %d 0x%lx\n",		\ | 		printk(KERN_DEBUG "%s %d 0x%lx\n",	\ | ||||||
| 			info->pins[j].name,		\ | 			info->pins[j].name,		\ | ||||||
| 			m[i], c[i]);			\ | 			m[i], c[i]);			\ | ||||||
| 	}						\ | 	}						\ | ||||||
|  | @ -201,9 +201,6 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev, | ||||||
| static void imx_dt_free_map(struct pinctrl_dev *pctldev, | static void imx_dt_free_map(struct pinctrl_dev *pctldev, | ||||||
| 				struct pinctrl_map *map, unsigned num_maps) | 				struct pinctrl_map *map, unsigned num_maps) | ||||||
| { | { | ||||||
| 	int i; |  | ||||||
| 
 |  | ||||||
| 	for (i = 0; i < num_maps; i++) |  | ||||||
| 	kfree(map); | 	kfree(map); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -475,9 +472,8 @@ static int __devinit imx_pinctrl_parse_groups(struct device_node *np, | ||||||
| 		grp->configs[j] = config & ~IMX_PAD_SION; | 		grp->configs[j] = config & ~IMX_PAD_SION; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| #ifdef DEBUG |  | ||||||
| 	IMX_PMX_DUMP(info, grp->pins, grp->mux_mode, grp->configs, grp->npins); | 	IMX_PMX_DUMP(info, grp->pins, grp->mux_mode, grp->configs, grp->npins); | ||||||
| #endif | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Devendra Naga
				Devendra Naga