The partition devices that blk_post_probe() binds for a block device
are not unbound when the block device is removed. When it is probed
again, a second set of partition devices is bound, and the EFI disk
code fails to add the stale ones:

  Adding partition for [email protected]:1 failed
  switch to partitions #0, ERROR

This was seen on an i.MX93 board where a single failed read during the
first probe of the SD card made the card unusable for the rest of the
boot.

Patch 1 unbinds the partition devices in the pre_remove hook of the
block uclass. Patch 2 adds a sandbox test for it.

Signed-off-by: Frieder Schrempf <[email protected]>
---
Frieder Schrempf (2):
      blk: Unbind partition devices when removing a block device
      test: blk: Check that partition devices are unbound on remove

 drivers/block/blk-uclass.c | 22 ++++++++++++++++
 test/dm/blk.c              | 64 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+)
---
base-commit: dfcfc4c9f78d1743f490a497082a4ec8e058aae8
change-id: 20261027-blk-part-unbind-e6ba8f1ac8ca

Best regards,
--  
Frieder Schrempf <[email protected]>

Reply via email to