OSDN Git Service

pxa168: fix double deallocation of managed resources
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Sat, 25 Apr 2015 01:07:03 +0000 (04:07 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 May 2015 20:03:34 +0000 (22:03 +0200)
commitf80e3eb94b7d4b5b9ebf999da1f50cd5b263a23d
tree11f32bff92ffe5da0e7cb1953a0714b68cb64f0d
parentf009181dcccd55398f872d090fa2e1780b4ca270
pxa168: fix double deallocation of managed resources

[ Upstream commit 0e03fd3e335d272bee88fe733d5fd13f5c5b7140 ]

Commit 43d3ddf87a57 ("net: pxa168_eth: add device tree support") starts
to use managed resources by adding devm_clk_get() and
devm_ioremap_resource(), but it leaves explicit iounmap() and clock_put()
in pxa168_eth_remove() and in failure handling code of pxa168_eth_probe().
As a result double free can happen.

The patch removes explicit resource deallocation. Also it converts
clk_disable() to clk_disable_unprepare() to make it symmetrical with
clk_prepare_enable().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/marvell/pxa168_eth.c