powerpc/papr_scm: Fix leaking 'bus_desc.provider_name' in some paths
authorVaibhav Jain <vaibhav@linux.ibm.com>
Wed, 22 Jan 2020 15:51:40 +0000 (21:21 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Feb 2020 21:34:16 +0000 (16:34 -0500)
commit5ca556d5edfd66cd89da7e2b26dfbd4858735e71
treeb41fc07a6c90fd3900101119513e6b44e3232aa7
parent05a23f436471816b6a22afd0511d3747972a564b
powerpc/papr_scm: Fix leaking 'bus_desc.provider_name' in some paths

commit 5649607a8d0b0e019a4db14aab3de1e16c3a2b4f upstream.

String 'bus_desc.provider_name' allocated inside
papr_scm_nvdimm_init() will leaks in case call to
nvdimm_bus_register() fails or when papr_scm_remove() is called.

This minor patch ensures that 'bus_desc.provider_name' is freed in
error path for nvdimm_bus_register() as well as in papr_scm_remove().

Fixes: b5beae5e224f ("powerpc/pseries: Add driver for PAPR SCM regions")
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200122155140.120429-1-vaibhav@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/platforms/pseries/papr_scm.c