Files
Zhu Ling 08b54e16d5 mmc: core: Fix OF node reference leak on card add failure
mmc_of_find_child_device() returns a device node with its reference count
incremented. mmc_add_card() stores the reference before calling
device_add(), while the card is marked present only after device_add()
succeeds.

If device_add() fails, the callers release the card through
mmc_remove_card(). However, mmc_remove_card() only drops the OF node
reference for a present card, leaking the reference on this error path.

Move of_node_put() outside the present-card conditional so the reference
is released for both registered cards and card-add failures.

Fixes: 25185f3f31 ("mmc: Add SDIO function devicetree subnode parsing")
Cc: [email protected]
Signed-off-by: Zhu Ling <[email protected]>
Reviewed-by: Shawn Lin <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
2026-09-10 14:20:54 +02:00
..
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…