]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/83xx/mpc832x_rdb: call platform_device_put() in error case in of_fsl_spi_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Sat, 29 Oct 2022 11:16:26 +0000 (19:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:30 +0000 (11:41 +0100)
[ Upstream commit 93e91a658ec54c29f8909c8e8a0e68fb935c2989 ]

If platform_device_add() is not called or failed, it can not call
platform_device_del() to clean up memory, it should call
platform_device_put() in error case.

Fixes: 4432747d5443 ("[POWERPC] fsl_soc: add support for fsl_spi")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20221029111626.429971-1-yangyingliang@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/platforms/83xx/mpc832x_rdb.c

index 4588ce632484e1f81fabe04dfc9ac0d46e74bbe8..b6354054f88343e8537dceb08bbd5c3fc87a995e 100644 (file)
@@ -107,7 +107,7 @@ static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk,
 
                goto next;
 unreg:
-               platform_device_del(pdev);
+               platform_device_put(pdev);
 err:
                pr_err("%pOF: registration failed\n", np);
 next: