ARM: mmp: Fix failure to remove sram device
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 26 Jul 2021 20:01:58 +0000 (22:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Apr 2022 07:08:23 +0000 (09:08 +0200)
commit82d919fbdea37f2281457c97fde5a56ed6265e61
tree6d9720b8a05655e864b29002ef8f73a21ed931fd
parent3733f47f904e4dc4cdb91c7c220e8c3f6cddbc36
ARM: mmp: Fix failure to remove sram device

[ Upstream commit 4036b29a146b2749af3bb213b003eb69f3e5ecc4 ]

Make sure in .probe() to set driver data before the function is left to
make it possible in .remove() to undo the actions done.

This fixes a potential memory leak and stops returning an error code in
.remove() that is ignored by the driver core anyhow.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm/mach-mmp/sram.c