pinctrl: free allocated pinctrl_map structure only once and use kernel facilities for IMX_PMX_DUMP
Subsystems (2)
PATCH 1/2 pinctrl: 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.
--- drivers/pinctrl/pinctrl-imx.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/pinctrl/pinctrl-imx.c +11 -12
@@ -27,16 +27,16 @@#include "core.h" #include "pinctrl-imx.h" -#define IMX_PMX_DUMP (info, p, m, c, n) \ -{ \ - int i, j; \ - printk("Format: Pin Mux Config\n"); \ - for (i = 0; i < n; i++) { \ - j = p[i]; \ - printk("%s %d 0x%lx\n", \ - info->pins[j].name, \ - m[i], c[i]); \ - } \ +#define IMX_PMX_DUMP (info, p, m, c, n) \ +{ \ + int i, j; \ + printk(KERN_DEBUG "Format: Pin Mux Config\n"); \ + for (i = 0; i < n; i++) { \ + j = p[i]; \ + printk(KERN_DEBUG "%s %d 0x%lx\n", \ + info->pins[j].name, \ + m[i], c[i]); \ + } \ }/* The bits in CONFIG cell defined in binding doc*/
@@ -203,8 +203,7 @@ static void imx_dt_free_map(struct pinctrl_dev *pctldev, {int i; -for (i =0 ; i < num_maps; i++) -kfree (map); +kfree (map); }static struct pinctrl_ops imx_pctrl_ops = {
Signature · 1 line
1.7.9.5
Anybody Please??
Quoted 75 lines · Devendra Naga
a) as we allocate the
pinctrl_mapstructure atimx_dt_node_to_mapat line 167, anyway if its an element, or anum_elements* (sizeof(type)) elements allocated to one single pointer must be freed only once.CASE. A)
as
new_mapis 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_DEBUGfacility for theIMX_PMX_DUMPmacro.Signed-off-by Devendra Naga <[email protected]>---
drivers/pinctrl/pinctrl-imx.c | 23 +++++++++++------------1 file changed, 11 insertions(+), 12 deletions(-)drivers/pinctrl/pinctrl-imx.c +11
-13@@ -27,16 +27,16 @@ #include "core.h" #include "pinctrl-imx.h" -#define IMX_PMX_DUMP (info, p, m, c, n) \ -{ \ - int i, j; \ - printk("Format: Pin Mux Config\n"); \ - for (i = 0; i < n; i++) { \ - j = p[i]; \ - printk("%s %d 0x%lx\n", \ - info->pins[j].name, \ - m[i], c[i]); \ - } \ +#define IMX_PMX_DUMP (info, p, m, c, n) \ +{ \ + int i, j; \ + printk(KERN_DEBUG "Format: Pin Mux Config\n"); \ + for (i = 0; i < n; i++) { \ + j = p[i]; \ + printk(KERN_DEBUG "%s %d 0x%lx\n", \ + info->pins[j].name, \ + m[i], c[i]); \ + } \ } /* The bits in CONFIG cell defined in binding doc*/@@ -203,8 +203,7 @@ static void imx_dt_free_map(struct pinctrl_dev *pctldev, { int i; - for (i = 0; i < num_maps; i++) - kfree(map); + kfree(map); } static struct pinctrl_ops imx_pctrl_ops = { --1.7.9.5
Quoted 22 lines · Devendra Naga
a) as we allocate the
pinctrl_mapstructure atimx_dt_node_to_mapat line 167, anyway if its an element, or anum_elements* (sizeof(type)) elements allocated to one single pointer must be freed only once.CASE. A)
as
new_mapis 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);
Quoted 8 lines
it just needs kfree not as case A's.
b) use
KERN_DEBUGfacility for theIMX_PMX_DUMPmacro.Signed-off-by Devendra Naga <[email protected]>---
drivers/pinctrl/pinctrl-imx.c | 23 +++++++++++------------1 file changed, 11 insertions(+), 12 deletions(-)
Shawn/Dong: can you look at this patch too?
Yours,
Linus Walleij
Quoted 1 line · devendra.aaru
Anybody Please??
Take it easy. Give the Freescalers some time to review...
If nothing happens for a week I'll just apply it so they can shout if there's something wrong with it :-D
Linus
Hi Linus,
Thanks for the reply,
Quoted 9 lines · Linus Walleij
Quoted 1 line · devendra.aaru
Anybody Please??
Take it easy. Give the Freescalers some time to review...
If nothing happens for a week I'll just apply it so they can shout if there's something wrong with it :-D
Sorry for shouting ... :(
Quoted 1 line
Linus
Thanks,
Devendra.
Quoted 22 lines · Devendra Naga
a) as we allocate the
pinctrl_mapstructure atimx_dt_node_to_mapat line 167, anyway if its an element, or anum_elements* (sizeof(type)) elements allocated to one single pointer must be freed only once.CASE. A)
as
new_mapis 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 likenew_map = kmalloc(numelems * size, GFP_KERNEL);
Quoted 9 lines
it just needs kfree not as case A's.
b) use
KERN_DEBUGfacility for theIMX_PMX_DUMPmacro.Signed-off-by Devendra Naga <[email protected]>--- drivers/pinctrl/pinctrl-imx.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
Sorry for late reply.
I missed this patch series.
You can CC me next time. :)
Quoted 18 lines
drivers/pinctrl/pinctrl-imx.c +0
-10@@ -27,16 +27,16 @@#include "core.h" #include "pinctrl-imx.h" -#define IMX_PMX_DUMP (info, p, m, c, n) \ -{ \ - int i, j; \ - printk("Format: Pin Mux Config\n"); \ - for (i = 0; i < n; i++) { \ - j = p[i]; \ - printk("%s %d 0x%lx\n", \ - info->pins[j].name, \ - m[i], c[i]); \ - } \
drivers/pinctrl/pinctrl-imx.c line 39
Quoted 10 lines
drivers/pinctrl/pinctrl-imx.c +10
-0+#define IMX_PMX_DUMP (info, p, m, c, n) \ +{ \ + int i, j; \ + printk(KERN_DEBUG "Format: Pin Mux Config\n"); \ + for (i = 0; i < n; i++) { \ + j = p[i]; \ + printk(KERN_DEBUG "%s %d 0x%lx\n", \ + info->pins[j].name, \ + m[i], c[i]); \ + } \
I can't remember clearly but i encountered a strange issue before that the format was not what i want with KERN_DEBUG... But i just tried your patch and it did not appear.
So i'm ok with this change.
drivers/pinctrl/pinctrl-imx.c static void imx_dt_free_map(struct pinctrl_dev *pctldev, · line 204
Quoted 6 lines
drivers/pinctrl/pinctrl-imx.c +0
-0}/* The bits in CONFIG cell defined in binding doc*/ @@ -203,8 +203,7 @@ static void imx_dt_free_map(struct pinctrl_dev *pctldev, {int i;
Also need removed?
drivers/pinctrl/pinctrl-imx.c static void imx_dt_free_map(struct pinctrl_dev *pctldev, · line 206
Quoted 4 lines
drivers/pinctrl/pinctrl-imx.c +1
-2-for (i =0 ; i < num_maps; i++) -kfree (map); +kfree (map);
BTW, it would be better if the change the patch title to:
"pinctrl: pinctrl-imx: ...."
Otherwise,
Regards
Dong Aisheng
Hi Dong,
Thanks for the review.
Quoted 69 lines · Dong Aisheng
Quoted 22 lines · Devendra Naga
a) as we allocate the
pinctrl_mapstructure atimx_dt_node_to_mapat line 167, anyway if its an element, or anum_elements* (sizeof(type)) elements allocated to one single pointer must be freed only once.CASE. A)
as
new_mapis 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);Quoted 9 lines
it just needs kfree not as case A's.
b) use
KERN_DEBUGfacility for theIMX_PMX_DUMPmacro.Signed-off-by Devendra Naga <[email protected]>---
drivers/pinctrl/pinctrl-imx.c | 23 +++++++++++------------1 file changed, 11 insertions(+), 12 deletions(-)Sorry for late reply.
I missed this patch series.
You can CC me next time. :)Quoted 18 lines
drivers/pinctrl/pinctrl-imx.c +0
-10@@ -27,16 +27,16 @@ #include "core.h" #include "pinctrl-imx.h" -#define IMX_PMX_DUMP (info, p, m, c, n) \ -{ \ - int i, j; \ - printk("Format: Pin Mux Config\n"); \ - for (i = 0; i < n; i++) { \ - j = p[i]; \ - printk("%s %d 0x%lx\n", \ - info->pins[j].name, \ - m[i], c[i]); \ - } \drivers/pinctrl/pinctrl-imx.c line 39
Quoted 10 lines
drivers/pinctrl/pinctrl-imx.c +10
-0+#define IMX_PMX_DUMP (info, p, m, c, n) \ +{ \ + int i, j; \ + printk(KERN_DEBUG "Format: Pin Mux Config\n"); \ + for (i = 0; i < n; i++) { \ + j = p[i]; \ + printk(KERN_DEBUG "%s %d 0x%lx\n", \ + info->pins[j].name, \ + m[i], c[i]); \ + } \I can't remember clearly but i encountered a strange issue before that the format was not what i want with
KERN_DEBUG... But i just tried your patch and it did not appear.
So i'm ok with this change.
Quoted 8 lines
drivers/pinctrl/pinctrl-imx.c static void imx_dt_free_map(struct pinctrl_dev *pctldev, · line 204
Quoted 6 lines
drivers/pinctrl/pinctrl-imx.c +0
-0} /* The bits in CONFIG cell defined in binding doc*/@@ -203,8 +203,7 @@ static void imx_dt_free_map(struct pinctrl_dev *pctldev, { int i;Also need removed?
Yeah. sorry , will send again with you Ack.
Quoted 7 lines
drivers/pinctrl/pinctrl-imx.c static void imx_dt_free_map(struct pinctrl_dev *pctldev, · line 206
Quoted 4 lines
drivers/pinctrl/pinctrl-imx.c +1
-2- for (i = 0; i < num_maps; i++) - kfree(map); + kfree(map);BTW, it would be better if the change the patch title to:
"pinctrl: pinctrl-imx: ...."
Ok sure.
Quoted 7 lines
Otherwise,
Acked-by Dong Aisheng <[email protected]>Regards
Dong Aisheng
Thanks,
Devendra.