From: Oleg Drokin Date: Fri, 11 Mar 2011 01:17:27 +0000 (+0300) Subject: firewire: ohci: Misleading kfree in ohci.c::pci_probe/remove X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d838d2c09af0820e306e3e9e31f97e873823b0b4;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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: Oleg Drokin It is perhaps just a rudiment from before mainline submission of the driver. Signed-off-by: Stefan Richter --- diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 8f1e3ce930d6..f903d7b6f34a 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c @@ -3309,7 +3309,7 @@ static int __devinit pci_probe(struct pci_dev *dev, fail_disable: pci_disable_device(dev); fail_free: - kfree(&ohci->card); + kfree(ohci); pmac_ohci_off(dev); fail: if (err == -ENOMEM) @@ -3353,7 +3353,7 @@ static void pci_remove(struct pci_dev *dev) pci_iounmap(dev, ohci->registers); pci_release_region(dev, 0); pci_disable_device(dev); - kfree(&ohci->card); + kfree(ohci); pmac_ohci_off(dev); fw_notify("Removed fw-ohci device.\n");