[PATCH 7/8] platform/x86: punit_ipc: switch to devm_mutex_init()

From: chitranshmandhaniya

Date: Fri Oct 30 2026 - 04:24:49 EST


From: Chitransh Mandhaniya <Chitransh_Mandhaniya@xxxxxxxx>

Replace mutex_init() with devm_mutex_init() so the mutex is
automatically destroyed on driver removal via devres. The driver was
missing a mutex_destroy() call on the teardown path.

Signed-off-by: Chitransh Mandhaniya <Chitransh_Mandhaniya@xxxxxxxx>
---
drivers/platform/x86/intel/punit_ipc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel/punit_ipc.c b/drivers/platform/x86/intel/punit_ipc.c
index a3d2b0b64135..1fdffe3ed8b8 100644
--- a/drivers/platform/x86/intel/punit_ipc.c
+++ b/drivers/platform/x86/intel/punit_ipc.c
@@ -260,7 +260,9 @@ static int intel_punit_ipc_probe(struct platform_device *pdev)
return ret;

punit_ipcdev->dev = &pdev->dev;
- mutex_init(&punit_ipcdev->lock);
+ ret = devm_mutex_init(&pdev->dev, &punit_ipcdev->lock);
+ if (ret)
+ return ret;
init_completion(&punit_ipcdev->cmd_complete);

return 0;
--
2.43.0