summaryrefslogtreecommitdiff
path: root/drivers/mfd/mc13xxx-spi.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-06-29 15:14:36 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2012-07-09 00:16:08 +0200
commite7c706b1e5ccf28eaaf76c7a4613e80b0ca52863 (patch)
tree70e260841527b64e699bbc41d907fdc10cd332f6 /drivers/mfd/mc13xxx-spi.c
parente4ecf6ea84d68aea5a9785e89f52672e1e126998 (diff)
mfd: Use devm_* APIs for mc13xxx
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/mc13xxx-spi.c')
-rw-r--r--drivers/mfd/mc13xxx-spi.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 03df422feb76..234207f7a831 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -129,7 +129,7 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
if (of_id)
sdrv->id_table = &mc13xxx_device_id[(enum mc13xxx_id) of_id->data];
- mc13xxx = kzalloc(sizeof(*mc13xxx), GFP_KERNEL);
+ mc13xxx = devm_kzalloc(&spi->dev, sizeof(*mc13xxx), GFP_KERNEL);
if (!mc13xxx)
return -ENOMEM;
@@ -139,15 +139,12 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
mc13xxx->dev = &spi->dev;
mutex_init(&mc13xxx->lock);
- mc13xxx->regmap = regmap_init(&spi->dev, &regmap_mc13xxx_bus, &spi->dev,
- &mc13xxx_regmap_spi_config);
-
+ mc13xxx->regmap = devm_regmap_init_spi(spi, &mc13xxx_regmap_spi_config);
if (IS_ERR(mc13xxx->regmap)) {
ret = PTR_ERR(mc13xxx->regmap);
dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n",
ret);
dev_set_drvdata(&spi->dev, NULL);
- kfree(mc13xxx);
return ret;
}