summaryrefslogtreecommitdiff
path: root/drivers/mfd/janz-cmodio.c
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-05-23 19:25:15 +0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-13 14:11:44 +0400
commitfa75d4a6799ff73be55ae44ca7bc5470239a13db (patch)
treee00bec378a28fadc1b811288cf09c795daa8ec39 /drivers/mfd/janz-cmodio.c
parent8692881e38644383398affaa68fcabc0299a4d7f (diff)
downloadlinux-fa75d4a6799ff73be55ae44ca7bc5470239a13db.tar.xz
mfd: janz-cmodio: Convert to managed resources for allocating memory
Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/janz-cmodio.c')
-rw-r--r--drivers/mfd/janz-cmodio.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/mfd/janz-cmodio.c b/drivers/mfd/janz-cmodio.c
index 45ece11cc27c..fcbb2e9dfd37 100644
--- a/drivers/mfd/janz-cmodio.c
+++ b/drivers/mfd/janz-cmodio.c
@@ -183,11 +183,10 @@ static int cmodio_pci_probe(struct pci_dev *dev,
struct cmodio_device *priv;
int ret;
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv) {
dev_err(&dev->dev, "unable to allocate private data\n");
- ret = -ENOMEM;
- goto out_return;
+ return -ENOMEM;
}
pci_set_drvdata(dev, priv);
@@ -197,7 +196,7 @@ static int cmodio_pci_probe(struct pci_dev *dev,
ret = pci_enable_device(dev);
if (ret) {
dev_err(&dev->dev, "unable to enable device\n");
- goto out_free_priv;
+ return ret;
}
pci_set_master(dev);
@@ -248,9 +247,7 @@ out_pci_release_regions:
pci_release_regions(dev);
out_pci_disable_device:
pci_disable_device(dev);
-out_free_priv:
- kfree(priv);
-out_return:
+
return ret;
}
@@ -263,7 +260,6 @@ static void cmodio_pci_remove(struct pci_dev *dev)
iounmap(priv->ctrl);
pci_release_regions(dev);
pci_disable_device(dev);
- kfree(priv);
}
#define PCI_VENDOR_ID_JANZ 0x13c3