aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adcxx.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-06-02 12:57:58 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-09-24 00:08:29 -0400
commitc60da82593b30d3b3b97e80f6f74b5f4afa9d0b5 (patch)
treeb18333948db64759befbe06a01556b92f1a586c7 /drivers/hwmon/adcxx.c
parentd5282926aa89587d78bbfeb6655500b1a72de15c (diff)
hwmon: (adcxx) Convert to use devm_ functions
Convert to use devm_ functions to reduce code size and simplify the code. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/adcxx.c')
-rw-r--r--drivers/hwmon/adcxx.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index a3d3183454ad..111af7c4a3d4 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -171,7 +171,7 @@ static int __devinit adcxx_probe(struct spi_device *spi)
171 int status; 171 int status;
172 int i; 172 int i;
173 173
174 adc = kzalloc(sizeof *adc, GFP_KERNEL); 174 adc = devm_kzalloc(&spi->dev, sizeof(*adc), GFP_KERNEL);
175 if (!adc) 175 if (!adc)
176 return -ENOMEM; 176 return -ENOMEM;
177 177
@@ -208,7 +208,6 @@ out_err:
208 208
209 spi_set_drvdata(spi, NULL); 209 spi_set_drvdata(spi, NULL);
210 mutex_unlock(&adc->lock); 210 mutex_unlock(&adc->lock);
211 kfree(adc);
212 return status; 211 return status;
213} 212}
214 213
@@ -224,7 +223,6 @@ static int __devexit adcxx_remove(struct spi_device *spi)
224 223
225 spi_set_drvdata(spi, NULL); 224 spi_set_drvdata(spi, NULL);
226 mutex_unlock(&adc->lock); 225 mutex_unlock(&adc->lock);
227 kfree(adc);
228 226
229 return 0; 227 return 0;
230} 228}