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>
Fri, 8 Apr 2022 12:24:02 +0000 (14:24 +0200)
commit4ab0293c961b75f914d05c9ed67fbb137315955a
treea90e03b993bd0848dbb78b022c5fb08fb45e764b
parentf8ef3b979bfab784be5d54df11fc3066de73eae7
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