diff options
Diffstat (limited to 'drivers/pinctrl/pinctrl-mxs.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-mxs.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/pinctrl/pinctrl-mxs.c b/drivers/pinctrl/pinctrl-mxs.c index 556e45a213eb..4ba4636b6a4a 100644 --- a/drivers/pinctrl/pinctrl-mxs.c +++ b/drivers/pinctrl/pinctrl-mxs.c | |||
@@ -107,8 +107,10 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
107 | 107 | ||
108 | /* Compose group name */ | 108 | /* Compose group name */ |
109 | group = kzalloc(length, GFP_KERNEL); | 109 | group = kzalloc(length, GFP_KERNEL); |
110 | if (!group) | 110 | if (!group) { |
111 | return -ENOMEM; | 111 | ret = -ENOMEM; |
112 | goto free; | ||
113 | } | ||
112 | snprintf(group, length, "%s.%d", np->name, reg); | 114 | snprintf(group, length, "%s.%d", np->name, reg); |
113 | new_map[i].data.mux.group = group; | 115 | new_map[i].data.mux.group = group; |
114 | i++; | 116 | i++; |
@@ -118,7 +120,7 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
118 | pconfig = kmemdup(&config, sizeof(config), GFP_KERNEL); | 120 | pconfig = kmemdup(&config, sizeof(config), GFP_KERNEL); |
119 | if (!pconfig) { | 121 | if (!pconfig) { |
120 | ret = -ENOMEM; | 122 | ret = -ENOMEM; |
121 | goto free; | 123 | goto free_group; |
122 | } | 124 | } |
123 | 125 | ||
124 | new_map[i].type = PIN_MAP_TYPE_CONFIGS_GROUP; | 126 | new_map[i].type = PIN_MAP_TYPE_CONFIGS_GROUP; |
@@ -133,6 +135,9 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
133 | 135 | ||
134 | return 0; | 136 | return 0; |
135 | 137 | ||
138 | free_group: | ||
139 | if (!purecfg) | ||
140 | kfree(group); | ||
136 | free: | 141 | free: |
137 | kfree(new_map); | 142 | kfree(new_map); |
138 | return ret; | 143 | return ret; |
@@ -511,6 +516,7 @@ int __devinit mxs_pinctrl_probe(struct platform_device *pdev, | |||
511 | return 0; | 516 | return 0; |
512 | 517 | ||
513 | err: | 518 | err: |
519 | platform_set_drvdata(pdev, NULL); | ||
514 | iounmap(d->base); | 520 | iounmap(d->base); |
515 | return ret; | 521 | return ret; |
516 | } | 522 | } |
@@ -520,6 +526,7 @@ int __devexit mxs_pinctrl_remove(struct platform_device *pdev) | |||
520 | { | 526 | { |
521 | struct mxs_pinctrl_data *d = platform_get_drvdata(pdev); | 527 | struct mxs_pinctrl_data *d = platform_get_drvdata(pdev); |
522 | 528 | ||
529 | platform_set_drvdata(pdev, NULL); | ||
523 | pinctrl_unregister(d->pctl); | 530 | pinctrl_unregister(d->pctl); |
524 | iounmap(d->base); | 531 | iounmap(d->base); |
525 | 532 | ||