mmc: Avoid uniniting twice
authorSimon Glass <sjg@chromium.org>
Sun, 16 Feb 2025 12:55:59 +0000 (05:55 -0700)
committerPeng Fan <peng.fan@nxp.com>
Fri, 11 Apr 2025 03:49:51 +0000 (11:49 +0800)
commitd99f8d2d749c0e1b352766281f5f5d71fa845f76
treedb72e40406a8a0a30ea8a5f4fead7ef8b2008f22
parent2057bb4b5160a3668d4785adb6ce0f0d08325c48
mmc: Avoid uniniting twice

Each MMC device has a child which ihs a block device. At present we call
mmc_deinit() when the block device is removed.

But the MMC struct (i.e. struct mmc) is attached to the MMC's device,
not its child.

So at present, when an MMC device is removed, mmc_deinit() is called
twice, once for the MMC device and once for its block device. This
results in a double call to cyclic_unregister().

Fix this by adding a 'remove' method to the uclass and calling
mmc_deinit() from there.

Also drop the call to device_probe() within the block-device's probe()
method. The device is already in the process of being probed, so this
call does nothing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: c822c1a50bd ("mmc: call device_probe() after scanning")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/mmc/mmc-uclass.c