powerpc/powernv: Add a null pointer check to scom_debug_init_one()
authorKunwu Chan <chentao@kylinos.cn>
Fri, 8 Dec 2023 08:59:37 +0000 (16:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:13 +0000 (15:35 -0800)
commitdd8422ff271c22058560832fc3006324ded895a9
treef0cc7dc0d4d9955ac4a11fc559e85fedd5aab026
parentbc063bf0934b0707be8ba31c82c4cbe073ffff0b
powerpc/powernv: Add a null pointer check to scom_debug_init_one()

[ Upstream commit 9a260f2dd827bbc82cc60eb4f4d8c22707d80742 ]

kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure.
Add a null pointer check, and release 'ent' to avoid memory leaks.

Fixes: bfd2f0d49aef ("powerpc/powernv: Get rid of old scom_controller abstraction")
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231208085937.107210-1-chentao@kylinos.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/platforms/powernv/opal-xscom.c