From: Guenter Roeck Date: Sat, 2 Jun 2012 16:57:58 +0000 (-0700) Subject: hwmon: (adcxx) Convert to use devm_ functions X-Git-Tag: next-20120917~87^2~50 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2f21b65424c05d059d6ac751b5ec550c59e9c1af;p=karo-tx-linux.git 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 --- 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) int status; int i; - adc = kzalloc(sizeof *adc, GFP_KERNEL); + adc = devm_kzalloc(&spi->dev, sizeof(*adc), GFP_KERNEL); if (!adc) return -ENOMEM; @@ -208,7 +208,6 @@ out_err: spi_set_drvdata(spi, NULL); mutex_unlock(&adc->lock); - kfree(adc); return status; } @@ -224,7 +223,6 @@ static int __devexit adcxx_remove(struct spi_device *spi) spi_set_drvdata(spi, NULL); mutex_unlock(&adc->lock); - kfree(adc); return 0; }