From: jsg Date: Mon, 29 Jan 2024 01:37:52 +0000 (+0000) Subject: drm/radeon/trinity_dpm: fix a memleak in trinity_parse_power_table X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6ee266b038160761b783d5ed8c3bee55c648f443;p=openbsd drm/radeon/trinity_dpm: fix a memleak in trinity_parse_power_table From Zhipeng Lu 0564e8a427914015d773a32f6e9baa2bd2f38a37 in linux-6.6.y/6.6.14 28c28d7f77c06ac2c0b8f9c82bc04eba22912b3b in mainline linux --- diff --git a/sys/dev/pci/drm/radeon/trinity_dpm.c b/sys/dev/pci/drm/radeon/trinity_dpm.c index 08ea1c864cb..ef1cc7bad20 100644 --- a/sys/dev/pci/drm/radeon/trinity_dpm.c +++ b/sys/dev/pci/drm/radeon/trinity_dpm.c @@ -1726,8 +1726,10 @@ static int trinity_parse_power_table(struct radeon_device *rdev) non_clock_array_index = power_state->v2.nonClockInfoIndex; non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *) &non_clock_info_array->nonClockInfo[non_clock_array_index]; - if (!rdev->pm.power_state[i].clock_info) + if (!rdev->pm.power_state[i].clock_info) { + kfree(rdev->pm.dpm.ps); return -EINVAL; + } ps = kzalloc(sizeof(struct sumo_ps), GFP_KERNEL); if (ps == NULL) { kfree(rdev->pm.dpm.ps);