summaryrefslogtreecommitdiff
path: root/drivers/mfd/lpc_ich.c
diff options
context:
space:
mode:
authorAaron Sierra <asierra@xes-inc.com>2013-02-14 11:35:04 -0600
committerSamuel Ortiz <sameo@linux.intel.com>2013-02-15 18:43:38 +0100
commitff7109fa632654eaef657186f2942f5b679023d6 (patch)
treeffa81b07db0ddb0b8bfefd3d572002d06b7c82d5 /drivers/mfd/lpc_ich.c
parent3ec3090cf14ec0920a5fbe976b5aafd6084db435 (diff)
mfd: lpc_ich: Use devres API to allocate private data
And fix a kzalloc argument inversion bug while converting to devres. Signed-off-by: Aaron Sierra <asierra@xes-inc.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/lpc_ich.c')
-rw-r--r--drivers/mfd/lpc_ich.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c
index 5c2ef41fa24c..9f12f91d6296 100644
--- a/drivers/mfd/lpc_ich.c
+++ b/drivers/mfd/lpc_ich.c
@@ -916,7 +916,8 @@ static int lpc_ich_probe(struct pci_dev *dev,
int ret;
bool cell_added = false;
- priv = kmalloc(GFP_KERNEL, sizeof(struct lpc_ich_priv));
+ priv = devm_kzalloc(&dev->dev,
+ sizeof(struct lpc_ich_priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -952,7 +953,6 @@ static int lpc_ich_probe(struct pci_dev *dev,
dev_warn(&dev->dev, "No MFD cells added\n");
lpc_ich_restore_config_space(dev);
pci_set_drvdata(dev, NULL);
- kfree(priv);
return -ENODEV;
}
@@ -961,12 +961,9 @@ static int lpc_ich_probe(struct pci_dev *dev,
static void lpc_ich_remove(struct pci_dev *dev)
{
- void *priv = pci_get_drvdata(dev);
-
mfd_remove_devices(&dev->dev);
lpc_ich_restore_config_space(dev);
pci_set_drvdata(dev, NULL);
- kfree(priv);
}
static struct pci_driver lpc_ich_driver = {