]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Feb 2023 06:52:35 +0000 (07:52 +0100)
commit63e9a8f51d0dcdccdeb5c75235ce64538dab3f6f
tree2823fad410a6796c25040c2c9d6d818a0004d1e6
parentb2ca079b058dc972d6e8b8341417d521e4167eda
EDAC/highbank: Fix memory leak in highbank_mc_probe()

[ Upstream commit e7a293658c20a7945014570e1921bf7d25d68a36 ]

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: 504856d5ced5 ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/edac/highbank_mc_edac.c