lkml.org 
[lkml]   [2012]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 1/2] pinctrl: free allocated pinctrl_map structure only once and use kernel facilities for IMX_PMX_DUMP
    Date
    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>
    ---
    drivers/pinctrl/pinctrl-imx.c | 23 +++++++++++------------
    1 file changed, 11 insertions(+), 12 deletions(-)

    diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
    index f6e7c67..553ed95 100644
    --- a/drivers/pinctrl/pinctrl-imx.c
    +++ b/drivers/pinctrl/pinctrl-imx.c
    @@ -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


    \
     
     \ /
      Last update: 2012-06-02 19:41    [W:0.023 / U:2.432 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site