]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i3c: mipi-i3c-hci: Switch PIO data allocation to devm_kzalloc()
authorAdrian Hunter <adrian.hunter@intel.com>
Tue, 13 Jan 2026 07:26:47 +0000 (09:26 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 14 Jan 2026 16:21:09 +0000 (17:21 +0100)
The driver already uses managed resources, so convert the PIO data
structure allocation to devm_zalloc().  Remove the manual kfree().

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260113072702.16268-7-adrian.hunter@intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master/mipi-i3c-hci/pio.c

index 90dca56fc0c53900b5c7696fe63c7272d4a26106..3d633abf60994189dcb69ab6cc84712562340202 100644 (file)
@@ -140,7 +140,7 @@ static int hci_pio_init(struct i3c_hci *hci)
        struct hci_pio_data *pio;
        u32 val, size_val, rx_thresh, tx_thresh, ibi_val;
 
-       pio = kzalloc(sizeof(*pio), GFP_KERNEL);
+       pio = devm_kzalloc(hci->master.dev.parent, sizeof(*pio), GFP_KERNEL);
        if (!pio)
                return -ENOMEM;
 
@@ -220,8 +220,6 @@ static void hci_pio_cleanup(struct i3c_hci *hci)
                BUG_ON(pio->curr_rx);
                BUG_ON(pio->curr_tx);
                BUG_ON(pio->curr_resp);
-               kfree(pio);
-               hci->io_data = NULL;
        }
 }