aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2015-01-20 20:50:06 -0500
committerLinus Walleij <linus.walleij@linaro.org>2015-01-29 04:33:15 -0500
commit74b18de94cfb7b7a12b581015e8e317d4fa5d752 (patch)
tree1c304e5e3c5412d2794052fa3e9a67ee7a338574 /drivers/gpio
parentef3b2bd6f3c797d6672cf2739565752019458824 (diff)
gpio: ge: Convert to use devm_kstrdup
Use devm_kstrdup to simplify the error handling path. Also return -ENOMEM instead of 0 if devm_kstrdup fails. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-ge.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-ge.c b/drivers/gpio/gpio-ge.c
index 6ea930372028..f9ac3f351753 100644
--- a/drivers/gpio/gpio-ge.c
+++ b/drivers/gpio/gpio-ge.c
@@ -76,9 +76,12 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
76 } 76 }
77 77
78 /* Setup pointers to chip functions */ 78 /* Setup pointers to chip functions */
79 bgc->gc.label = kstrdup(pdev->dev.of_node->full_name, GFP_KERNEL); 79 bgc->gc.label = devm_kstrdup(&pdev->dev, pdev->dev.of_node->full_name,
80 if (!bgc->gc.label) 80 GFP_KERNEL);
81 if (!bgc->gc.label) {
82 ret = -ENOMEM;
81 goto err0; 83 goto err0;
84 }
82 85
83 bgc->gc.base = -1; 86 bgc->gc.base = -1;
84 bgc->gc.ngpio = (u16)(uintptr_t)of_id->data; 87 bgc->gc.ngpio = (u16)(uintptr_t)of_id->data;
@@ -88,11 +91,9 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
88 /* This function adds a memory mapped GPIO chip */ 91 /* This function adds a memory mapped GPIO chip */
89 ret = gpiochip_add(&bgc->gc); 92 ret = gpiochip_add(&bgc->gc);
90 if (ret) 93 if (ret)
91 goto err1; 94 goto err0;
92 95
93 return 0; 96 return 0;
94err1:
95 kfree(bgc->gc.label);
96err0: 97err0:
97 iounmap(regs); 98 iounmap(regs);
98 pr_err("%s: GPIO chip registration failed\n", 99 pr_err("%s: GPIO chip registration failed\n",