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:06:40 +0000 (09:06 +0200)
commit734ff1117d5f7d7ca41bda5666366bb95fbc062b
tree87d10ccc1e991ad249abe00320d3ed7090491a31
parentd3379b715b889d464d2a1e5d87f6088797027310
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