x86/pmem: Fix platform-device leak in error path
authorJohan Hovold <johan@kernel.org>
Mon, 20 Jun 2022 14:07:23 +0000 (16:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:23:07 +0000 (14:23 +0200)
commit377a4c5cb7abfd30bff2e516136d4a5a9d24eba4
treebdeefa0d81601baf380cf827ca0100877fff3b2b
parent5a73493f0d6ab9e662e4bb9ec7897752f6584228
x86/pmem: Fix platform-device leak in error path

[ Upstream commit 229e73d46994f15314f58b2d39bf952111d89193 ]

Make sure to free the platform device in the unlikely event that
registration fails.

Fixes: 7a67832c7e44 ("libnvdimm, e820: make CONFIG_X86_PMEM_LEGACY a tristate option")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220620140723.9810-1-johan@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kernel/pmem.c