Commit d838d2c0 authored by Oleg Drokin's avatar Oleg Drokin Committed by Stefan Richter

firewire: ohci: Misleading kfree in ohci.c::pci_probe/remove

It seems drivers/firewire/ohci.c is making some optimistic assumptions
about struct fw_ohci and that member "card" will always remain the first
member of the struct.
Plus it's probably going to confuse a lot of static code analyzers too.

So I wonder if there is a good reason not to free the ohci struct just
like it was allocated instead of the tricky &ohci->card way?
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>

It is perhaps just a rudiment from before mainline submission of the
driver.
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent b6258fc1
...@@ -3309,7 +3309,7 @@ static int __devinit pci_probe(struct pci_dev *dev, ...@@ -3309,7 +3309,7 @@ static int __devinit pci_probe(struct pci_dev *dev,
fail_disable: fail_disable:
pci_disable_device(dev); pci_disable_device(dev);
fail_free: fail_free:
kfree(&ohci->card); kfree(ohci);
pmac_ohci_off(dev); pmac_ohci_off(dev);
fail: fail:
if (err == -ENOMEM) if (err == -ENOMEM)
...@@ -3353,7 +3353,7 @@ static void pci_remove(struct pci_dev *dev) ...@@ -3353,7 +3353,7 @@ static void pci_remove(struct pci_dev *dev)
pci_iounmap(dev, ohci->registers); pci_iounmap(dev, ohci->registers);
pci_release_region(dev, 0); pci_release_region(dev, 0);
pci_disable_device(dev); pci_disable_device(dev);
kfree(&ohci->card); kfree(ohci);
pmac_ohci_off(dev); pmac_ohci_off(dev);
fw_notify("Removed fw-ohci device.\n"); fw_notify("Removed fw-ohci device.\n");
......
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