linux/drivers/i3c/master
Zilin Guan 8e71414e25 i3c: dw: Fix memory leak in dw_i3c_master_i2c_xfers()
[ Upstream commit 2537089413 ]

The dw_i3c_master_i2c_xfers() function allocates memory for the xfer
structure using dw_i3c_master_alloc_xfer(). If pm_runtime_resume_and_get()
fails, the function returns without freeing the allocated xfer, resulting
in a memory leak.

Add a dw_i3c_master_free_xfer() call to the error path to ensure the
allocated memory is properly freed.

Compile tested only. Issue found using a prototype static analysis tool
and code review.

Fixes: 62fe9d06f5 ("i3c: dw: Add power management support")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260126081121.644099-1-zilin@seu.edu.cn
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-02-26 14:58:58 -08:00
..
mipi-i3c-hci i3c: mipi-i3c-hci: Convert remaining DBG() prints to dev_dbg() 2025-09-16 17:06:42 +02:00
adi-i3c-master.c i3c: master: adi: fix number of bytes written to fifo 2025-09-29 00:11:59 +02:00
ast2600-i3c-master.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
dw-i3c-master.c i3c: dw: Fix memory leak in dw_i3c_master_i2c_xfers() 2026-02-26 14:58:58 -08:00
dw-i3c-master.h i3c: dw: Add quirk to address OD/PP timing issue on AMD platform 2024-11-18 14:27:29 +01:00
i3c-master-cdns.c i3c: master: cdns: Simplify handling clocks in probe() 2025-07-31 01:24:25 +02:00
Kconfig i3c: master: Add driver for Analog Devices I3C Controller IP 2025-09-16 17:06:43 +02:00
Makefile i3c: master: Add driver for Analog Devices I3C Controller IP 2025-09-16 17:06:43 +02:00
renesas-i3c.c i3c: renesas: Simplify return statement in 'renesas_i3c_daa' 2025-09-16 17:06:43 +02:00
svc-i3c-master.c i3c: master: svc: Prevent incomplete IBI transaction 2025-12-18 14:02:44 +01:00