summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adcxx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/adcxx.c')
-rw-r--r--drivers/hwmon/adcxx.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index a3d3183454a..f4c5867170d 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -141,10 +141,7 @@ static ssize_t adcxx_set_max(struct device *dev,
static ssize_t adcxx_show_name(struct device *dev, struct device_attribute
*devattr, char *buf)
{
- struct spi_device *spi = to_spi_device(dev);
- struct adcxx *adc = spi_get_drvdata(spi);
-
- return sprintf(buf, "adcxx%ds\n", adc->channels);
+ return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
}
static struct sensor_device_attribute ad_input[] = {
@@ -171,7 +168,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 +205,6 @@ out_err:
spi_set_drvdata(spi, NULL);
mutex_unlock(&adc->lock);
- kfree(adc);
return status;
}
@@ -224,7 +220,6 @@ static int __devexit adcxx_remove(struct spi_device *spi)
spi_set_drvdata(spi, NULL);
mutex_unlock(&adc->lock);
- kfree(adc);
return 0;
}