Commit c60da825 authored by Guenter Roeck's avatar Guenter Roeck

hwmon: (adcxx) Convert to use devm_ functions

Convert to use devm_ functions to reduce code size and simplify the code.
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent d5282926
...@@ -171,7 +171,7 @@ static int __devinit adcxx_probe(struct spi_device *spi) ...@@ -171,7 +171,7 @@ static int __devinit adcxx_probe(struct spi_device *spi)
int status; int status;
int i; int i;
adc = kzalloc(sizeof *adc, GFP_KERNEL); adc = devm_kzalloc(&spi->dev, sizeof(*adc), GFP_KERNEL);
if (!adc) if (!adc)
return -ENOMEM; return -ENOMEM;
...@@ -208,7 +208,6 @@ static int __devinit adcxx_probe(struct spi_device *spi) ...@@ -208,7 +208,6 @@ static int __devinit adcxx_probe(struct spi_device *spi)
spi_set_drvdata(spi, NULL); spi_set_drvdata(spi, NULL);
mutex_unlock(&adc->lock); mutex_unlock(&adc->lock);
kfree(adc);
return status; return status;
} }
...@@ -224,7 +223,6 @@ static int __devexit adcxx_remove(struct spi_device *spi) ...@@ -224,7 +223,6 @@ static int __devexit adcxx_remove(struct spi_device *spi)
spi_set_drvdata(spi, NULL); spi_set_drvdata(spi, NULL);
mutex_unlock(&adc->lock); mutex_unlock(&adc->lock);
kfree(adc);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment