diff options
author | Lee Jones <lee.jones@linaro.org> | 2013-05-23 11:25:15 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-13 06:11:44 -0400 |
commit | fa75d4a6799ff73be55ae44ca7bc5470239a13db (patch) | |
tree | e00bec378a28fadc1b811288cf09c795daa8ec39 /drivers/mfd | |
parent | 8692881e38644383398affaa68fcabc0299a4d7f (diff) |
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')
-rw-r--r-- | drivers/mfd/janz-cmodio.c | 12 |
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, | |||
183 | struct cmodio_device *priv; | 183 | struct cmodio_device *priv; |
184 | int ret; | 184 | int ret; |
185 | 185 | ||
186 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 186 | priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); |
187 | if (!priv) { | 187 | if (!priv) { |
188 | dev_err(&dev->dev, "unable to allocate private data\n"); | 188 | dev_err(&dev->dev, "unable to allocate private data\n"); |
189 | ret = -ENOMEM; | 189 | return -ENOMEM; |
190 | goto out_return; | ||
191 | } | 190 | } |
192 | 191 | ||
193 | pci_set_drvdata(dev, priv); | 192 | pci_set_drvdata(dev, priv); |
@@ -197,7 +196,7 @@ static int cmodio_pci_probe(struct pci_dev *dev, | |||
197 | ret = pci_enable_device(dev); | 196 | ret = pci_enable_device(dev); |
198 | if (ret) { | 197 | if (ret) { |
199 | dev_err(&dev->dev, "unable to enable device\n"); | 198 | dev_err(&dev->dev, "unable to enable device\n"); |
200 | goto out_free_priv; | 199 | return ret; |
201 | } | 200 | } |
202 | 201 | ||
203 | pci_set_master(dev); | 202 | pci_set_master(dev); |
@@ -248,9 +247,7 @@ out_pci_release_regions: | |||
248 | pci_release_regions(dev); | 247 | pci_release_regions(dev); |
249 | out_pci_disable_device: | 248 | out_pci_disable_device: |
250 | pci_disable_device(dev); | 249 | pci_disable_device(dev); |
251 | out_free_priv: | 250 | |
252 | kfree(priv); | ||
253 | out_return: | ||
254 | return ret; | 251 | return ret; |
255 | } | 252 | } |
256 | 253 | ||
@@ -263,7 +260,6 @@ static void cmodio_pci_remove(struct pci_dev *dev) | |||
263 | iounmap(priv->ctrl); | 260 | iounmap(priv->ctrl); |
264 | pci_release_regions(dev); | 261 | pci_release_regions(dev); |
265 | pci_disable_device(dev); | 262 | pci_disable_device(dev); |
266 | kfree(priv); | ||
267 | } | 263 | } |
268 | 264 | ||
269 | #define PCI_VENDOR_ID_JANZ 0x13c3 | 265 | #define PCI_VENDOR_ID_JANZ 0x13c3 |