Skip to content

Commit f2ae725

Browse files
committed
platform/x86/amd: pmc: Use release_mem_region() to undo request_mem_region_muxed()
Muxed (mem) regions will wait in request_mem_region_muxed() if the region is busy (in use by another consumer) during the call. In order to wake-up possibly waiting other consumers of the region, it must be released by a release_mem_region() call, which will actually wake up any waiters. release_mem_region() also frees the resource created by request_mem_region_muxed(), avoiding the need for the unmatched kfree(). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20230711095920.264308-1-hdegoede@redhat.com
1 parent 8b58f75 commit f2ae725

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/platform/x86/amd/pmc-quirks.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <linux/dmi.h>
1212
#include <linux/io.h>
1313
#include <linux/ioport.h>
14-
#include <linux/slab.h>
1514

1615
#include "pmc.h"
1716

@@ -135,12 +134,10 @@ static const struct dmi_system_id fwbug_list[] = {
135134
*/
136135
static void amd_pmc_skip_nvme_smi_handler(u32 s2idle_bug_mmio)
137136
{
138-
struct resource *res;
139137
void __iomem *addr;
140138
u8 val;
141139

142-
res = request_mem_region_muxed(s2idle_bug_mmio, 1, "amd_pmc_pm80");
143-
if (!res)
140+
if (!request_mem_region_muxed(s2idle_bug_mmio, 1, "amd_pmc_pm80"))
144141
return;
145142

146143
addr = ioremap(s2idle_bug_mmio, 1);
@@ -152,8 +149,7 @@ static void amd_pmc_skip_nvme_smi_handler(u32 s2idle_bug_mmio)
152149

153150
iounmap(addr);
154151
cleanup_resource:
155-
release_resource(res);
156-
kfree(res);
152+
release_mem_region(s2idle_bug_mmio, 1);
157153
}
158154

159155
void amd_pmc_process_restore_quirks(struct amd_pmc_dev *dev)

0 commit comments

Comments
 (0)