Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

i3c: master: renesas: Fix memory leak in renesas_i3c_i3c_xfers()

The xfer structure allocated by renesas_i3c_alloc_xfer() was never freed
in the renesas_i3c_i3c_xfers() function. Use the __free(kfree) cleanup
attribute to automatically free the memory when the variable goes out of
scope.

Fixes: d028219a9f14 ("i3c: master: Add basic driver for the Renesas I3C controller")
Tested-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Link: https://patch.msgid.link/20260406-renesas-v3-1-4b724d7708f4@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Felix Gu and committed by
Alexandre Belloni
d7665c3b 19d6dd32

+2 -2
+2 -2
drivers/i3c/master/renesas-i3c.c
··· 8 8 9 9 #include <linux/bitfield.h> 10 10 #include <linux/bitops.h> 11 + #include <linux/cleanup.h> 11 12 #include <linux/clk.h> 12 13 #include <linux/completion.h> 13 14 #include <linux/err.h> ··· 818 817 struct i3c_master_controller *m = i3c_dev_get_master(dev); 819 818 struct renesas_i3c *i3c = to_renesas_i3c(m); 820 819 struct renesas_i3c_i2c_dev_data *data = i3c_dev_get_master_data(dev); 821 - struct renesas_i3c_xfer *xfer; 822 820 int i; 823 821 824 822 /* Enable I3C bus. */ 825 823 renesas_i3c_bus_enable(m, true); 826 824 827 - xfer = renesas_i3c_alloc_xfer(i3c, 1); 825 + struct renesas_i3c_xfer *xfer __free(kfree) = renesas_i3c_alloc_xfer(i3c, 1); 828 826 if (!xfer) 829 827 return -ENOMEM; 830 828