Skip to content

Commit

Permalink
hwmon: (lm70) Convert to use devm_ functions
Browse files Browse the repository at this point in the history
Convert to use devm_ functions to reduce code size and simplify the code.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
  • Loading branch information
Guenter Roeck committed Sep 24, 2012
1 parent a81b0f7 commit 33ed6d4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/hwmon/lm70.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static int __devinit lm70_probe(struct spi_device *spi)

/* NOTE: we assume 8-bit words, and convert to 16 bits manually */

p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL);
p_lm70 = devm_kzalloc(&spi->dev, sizeof(*p_lm70), GFP_KERNEL);
if (!p_lm70)
return -ENOMEM;

Expand Down Expand Up @@ -181,7 +181,6 @@ static int __devinit lm70_probe(struct spi_device *spi)
device_remove_file(&spi->dev, &dev_attr_temp1_input);
out_dev_create_temp_file_failed:
spi_set_drvdata(spi, NULL);
kfree(p_lm70);
return status;
}

Expand All @@ -193,7 +192,6 @@ static int __devexit lm70_remove(struct spi_device *spi)
device_remove_file(&spi->dev, &dev_attr_temp1_input);
device_remove_file(&spi->dev, &dev_attr_name);
spi_set_drvdata(spi, NULL);
kfree(p_lm70);

return 0;
}
Expand Down

0 comments on commit 33ed6d4

Please sign in to comment.