Commit fa75d4a6 authored by Lee Jones's avatar Lee Jones Committed by Samuel Ortiz

mfd: janz-cmodio: Convert to managed resources for allocating memory

Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 8692881e
...@@ -183,11 +183,10 @@ static int cmodio_pci_probe(struct pci_dev *dev, ...@@ -183,11 +183,10 @@ static int cmodio_pci_probe(struct pci_dev *dev,
struct cmodio_device *priv; struct cmodio_device *priv;
int ret; int ret;
priv = kzalloc(sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv) { if (!priv) {
dev_err(&dev->dev, "unable to allocate private data\n"); dev_err(&dev->dev, "unable to allocate private data\n");
ret = -ENOMEM; return -ENOMEM;
goto out_return;
} }
pci_set_drvdata(dev, priv); pci_set_drvdata(dev, priv);
...@@ -197,7 +196,7 @@ static int cmodio_pci_probe(struct pci_dev *dev, ...@@ -197,7 +196,7 @@ static int cmodio_pci_probe(struct pci_dev *dev,
ret = pci_enable_device(dev); ret = pci_enable_device(dev);
if (ret) { if (ret) {
dev_err(&dev->dev, "unable to enable device\n"); dev_err(&dev->dev, "unable to enable device\n");
goto out_free_priv; return ret;
} }
pci_set_master(dev); pci_set_master(dev);
...@@ -248,9 +247,7 @@ static int cmodio_pci_probe(struct pci_dev *dev, ...@@ -248,9 +247,7 @@ static int cmodio_pci_probe(struct pci_dev *dev,
pci_release_regions(dev); pci_release_regions(dev);
out_pci_disable_device: out_pci_disable_device:
pci_disable_device(dev); pci_disable_device(dev);
out_free_priv:
kfree(priv);
out_return:
return ret; return ret;
} }
...@@ -263,7 +260,6 @@ static void cmodio_pci_remove(struct pci_dev *dev) ...@@ -263,7 +260,6 @@ static void cmodio_pci_remove(struct pci_dev *dev)
iounmap(priv->ctrl); iounmap(priv->ctrl);
pci_release_regions(dev); pci_release_regions(dev);
pci_disable_device(dev); pci_disable_device(dev);
kfree(priv);
} }
#define PCI_VENDOR_ID_JANZ 0x13c3 #define PCI_VENDOR_ID_JANZ 0x13c3
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment