]> git.baikalelectronics.ru Git - kernel.git/commit
Free struct device in fw_dev_release()
authorCatalin Marinas <catalin.marinas@arm.com>
Wed, 8 Jul 2009 10:17:40 +0000 (11:17 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 8 Jul 2009 16:34:08 +0000 (09:34 -0700)
commit0e8b3b9e647d195f6f4e3486de7edc90a0515824
tree9677b25ca9df0bfb59e0bc70e8c19e2b4d3cc0af
parent17906ff972bd1acf6c7aa83e0133d900416649dc
Free struct device in fw_dev_release()

The f_dev in _request_firmware() is allocated via the fw_setup_device()
and fw_register_device() calls and its class set to firmware_class (the
class release function is fw_dev_release).

Commit ca873e3e6412 replaced the kfree(dev) in fw_dev_release() with a
put_device() call but my understanding is that the release function is
called via put_device -> kobject_put -> kref_put -> koject_release etc.
and it should call kfree since it's the last to see this device
structure alive.

Because of that, the _request_firmware() function on its -ENOENT error
path only calls device_unregister(f_dev) which would eventually call
fw_dev_release() but there is no kfree (the subsequent put_device call
would just make the kref negative).

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/base/firmware_class.c