EDAC/highbank: Fix memory leak in highbank_mc_probe()
authorMiaoqian Lin <linmq006@gmail.com>
Thu, 29 Dec 2022 05:48:24 +0000 (09:48 +0400)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 3 Jan 2023 16:03:57 +0000 (17:03 +0100)
commite7a293658c20a7945014570e1921bf7d25d68a36
tree6a004f463f0e543b280d8aad007bcc11a18c9bbf
parente84077437902ec99eba0a6b516df772653f142c7
EDAC/highbank: Fix memory leak in highbank_mc_probe()

When devres_open_group() fails, it returns -ENOMEM without freeing memory
allocated by edac_mc_alloc().

Call edac_mc_free() on the error handling path to avoid a memory leak.

  [ bp: Massage commit message. ]

Fixes: a1b01edb2745 ("edac: add support for Calxeda highbank memory controller")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Link: https://lore.kernel.org/r/20221229054825.1361993-1-linmq006@gmail.com
drivers/edac/highbank_mc_edac.c