From: jsg Date: Mon, 29 Jan 2024 01:51:19 +0000 (+0000) Subject: drm/amd/pm/smu7: fix a memleak in smu7_hwmgr_backend_init X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1d606c7052a7ad099e1693a8dd5461da69bc582d;p=openbsd drm/amd/pm/smu7: fix a memleak in smu7_hwmgr_backend_init From Zhipeng Lu ae7cbf935b9a1b41f65fe6443e7cd0c401500b20 in linux-6.6.y/6.6.14 2f3be3ca779b11c332441b10e00443a2510f4d7b in mainline linux --- diff --git a/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c b/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c index 120354c1e07..6fabd1eaa9f 100644 --- a/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +++ b/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c @@ -2974,6 +2974,8 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr) result = smu7_get_evv_voltages(hwmgr); if (result) { pr_info("Get EVV Voltage Failed. Abort Driver loading!\n"); + kfree(hwmgr->backend); + hwmgr->backend = NULL; return -EINVAL; } } else { @@ -3019,8 +3021,10 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr) } result = smu7_update_edc_leakage_table(hwmgr); - if (result) + if (result) { + smu7_hwmgr_backend_fini(hwmgr); return result; + } return 0; }