diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-03-15 05:15:49 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-03-27 11:05:12 -0400 |
commit | 632d8e55d1f0304579315669bfadcab7352973fd (patch) | |
tree | 1ff526a6c6d2f26a44461651aad8f4cb30153c58 | |
parent | b09638a4d6b8032f6569e6ec8a5cc373ced045aa (diff) |
gpio: mc33880: use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/gpio/gpio-mc33880.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-mc33880.c b/drivers/gpio/gpio-mc33880.c index 6a8fdc26ae6a..b16148913a78 100644 --- a/drivers/gpio/gpio-mc33880.c +++ b/drivers/gpio/gpio-mc33880.c | |||
@@ -101,7 +101,7 @@ static int mc33880_probe(struct spi_device *spi) | |||
101 | if (ret < 0) | 101 | if (ret < 0) |
102 | return ret; | 102 | return ret; |
103 | 103 | ||
104 | mc = kzalloc(sizeof(struct mc33880), GFP_KERNEL); | 104 | mc = devm_kzalloc(&spi->dev, sizeof(struct mc33880), GFP_KERNEL); |
105 | if (!mc) | 105 | if (!mc) |
106 | return -ENOMEM; | 106 | return -ENOMEM; |
107 | 107 | ||
@@ -143,7 +143,6 @@ static int mc33880_probe(struct spi_device *spi) | |||
143 | exit_destroy: | 143 | exit_destroy: |
144 | dev_set_drvdata(&spi->dev, NULL); | 144 | dev_set_drvdata(&spi->dev, NULL); |
145 | mutex_destroy(&mc->lock); | 145 | mutex_destroy(&mc->lock); |
146 | kfree(mc); | ||
147 | return ret; | 146 | return ret; |
148 | } | 147 | } |
149 | 148 | ||
@@ -159,10 +158,9 @@ static int mc33880_remove(struct spi_device *spi) | |||
159 | dev_set_drvdata(&spi->dev, NULL); | 158 | dev_set_drvdata(&spi->dev, NULL); |
160 | 159 | ||
161 | ret = gpiochip_remove(&mc->chip); | 160 | ret = gpiochip_remove(&mc->chip); |
162 | if (!ret) { | 161 | if (!ret) |
163 | mutex_destroy(&mc->lock); | 162 | mutex_destroy(&mc->lock); |
164 | kfree(mc); | 163 | else |
165 | } else | ||
166 | dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n", | 164 | dev_err(&spi->dev, "Failed to remove the GPIO controller: %d\n", |
167 | ret); | 165 | ret); |
168 | 166 | ||