diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2018-02-07 22:47:53 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-03-14 19:54:09 +0300 |
commit | ad8ce834bfec77c8ae2fbb3a0593ae87bdecebcb (patch) | |
tree | 3dc6cda5b0506f07e82e08204f7c8bbb6f680190 /drivers/parport | |
parent | 1089c91111a13e93955057e37f6772c0af629a2a (diff) | |
download | linux-ad8ce834bfec77c8ae2fbb3a0593ae87bdecebcb.tar.xz |
parport: Convert to use managed functions pcim_* and devm_*
This makes the error handling much more simpler than open-coding everything
and in addition makes the probe function smaller an tidier.
Tested-by: Nikola Ciprich <nikola.ciprich@linuxbox.cz>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/parport')
-rw-r--r-- | drivers/parport/parport_serial.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c index d0a5bc542bac..050eeb06913a 100644 --- a/drivers/parport/parport_serial.c +++ b/drivers/parport/parport_serial.c @@ -620,27 +620,23 @@ static int parport_serial_pci_probe(struct pci_dev *dev, struct parport_serial_private *priv; int err; - priv = kzalloc (sizeof *priv, GFP_KERNEL); + priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; + pci_set_drvdata (dev, priv); - err = pci_enable_device (dev); - if (err) { - kfree (priv); + err = pcim_enable_device(dev); + if (err) return err; - } - if (parport_register (dev, id)) { - kfree (priv); + if (parport_register(dev, id)) return -ENODEV; - } if (serial_register (dev, id)) { int i; for (i = 0; i < priv->num_par; i++) parport_pc_unregister_port (priv->port[i]); - kfree (priv); return -ENODEV; } @@ -660,7 +656,6 @@ static void parport_serial_pci_remove(struct pci_dev *dev) for (i = 0; i < priv->num_par; i++) parport_pc_unregister_port (priv->port[i]); - kfree (priv); return; } |