aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/lm70.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index 472f79521a96..dd7f0cafd197 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -149,7 +149,7 @@ static int __devinit lm70_probe(struct spi_device *spi)
149 149
150 /* NOTE: we assume 8-bit words, and convert to 16 bits manually */ 150 /* NOTE: we assume 8-bit words, and convert to 16 bits manually */
151 151
152 p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL); 152 p_lm70 = devm_kzalloc(&spi->dev, sizeof(*p_lm70), GFP_KERNEL);
153 if (!p_lm70) 153 if (!p_lm70)
154 return -ENOMEM; 154 return -ENOMEM;
155 155
@@ -181,7 +181,6 @@ out_dev_create_file_failed:
181 device_remove_file(&spi->dev, &dev_attr_temp1_input); 181 device_remove_file(&spi->dev, &dev_attr_temp1_input);
182out_dev_create_temp_file_failed: 182out_dev_create_temp_file_failed:
183 spi_set_drvdata(spi, NULL); 183 spi_set_drvdata(spi, NULL);
184 kfree(p_lm70);
185 return status; 184 return status;
186} 185}
187 186
@@ -193,7 +192,6 @@ static int __devexit lm70_remove(struct spi_device *spi)
193 device_remove_file(&spi->dev, &dev_attr_temp1_input); 192 device_remove_file(&spi->dev, &dev_attr_temp1_input);
194 device_remove_file(&spi->dev, &dev_attr_name); 193 device_remove_file(&spi->dev, &dev_attr_name);
195 spi_set_drvdata(spi, NULL); 194 spi_set_drvdata(spi, NULL);
196 kfree(p_lm70);
197 195
198 return 0; 196 return 0;
199} 197}