]> git.karo-electronics.de Git - karo-tx-linux.git/commit
USB: mos7840: fix port-data memory leak
authorJohan Hovold <jhovold@gmail.com>
Wed, 31 Oct 2012 19:52:42 +0000 (20:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Nov 2012 08:56:51 +0000 (09:56 +0100)
commit0813e85449a343a214462346f146f7b0f6a2053d
treee7a39884b7180ceee2b406795fb9299cddc61482
parentb7639e25716afc0211bcc14006a4af4e9e9bc2b9
USB: mos7840: fix port-data memory leak

commit 80c00750f0c9867a65b30a17880939b6bc660a77 upstream.

Fix port-data memory leak by moving port data allocation and
deallocation to port_probe and port_remove.

Since commit 0998d0631001288 (device-core: Ensure drvdata = NULL when no
driver is bound) the port private data is no longer freed at release as
it is no longer accessible.

Note that the indentation was kept intact using a do-while(0) in order
to facilitate review. A follow-up patch will remove it.

Compile-only tested.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/mos7840.c