mmc: misc fixes across MMC/SDHCI/RPMB
Get series with b4
b4 am [email protected] change-id 20260712-mmc-fix-cc14724541b8Versions newest first
- v2 Latest5 patches 3 repliesIn review
- v15 patches 4 repliesSuperseded
Changes in v2 from the cover letter
- Add R-b for patch 3
- Update commit message and Simplify code logic for patch 5
- Link to v1: https://patch.msgid.link/[email protected]
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | mmc: fix mmc_poll_for_busy() false timeout when card is readydrivers/ | +3 | 1 reply | |
| 2/5 | mmc: rpmb: fix tautological condition in RPMB_REQ_READ_DATA validationdrivers/ | +1 | 0 replies | |
| 3/5 | mmc: sdhci: fix align_buffer memory leak on re-initializationdrivers/ | +2 | 0 replies | |
| 4/5 | mmc: fix mmc_bwrite() ignoring host get_b_max() callbackdrivers/ drivers/ drivers/ | +9 | 1 reply | |
| 5/5 | mmc: fix mmc_deinit regression when card is at 1.8V signalingdrivers/ | +13 | 1 reply |
Reviews trailers per patch
3 of 5 patches have a Reviewed-by or Acked-by.
| Patch | Tanmay Kathpalia |
|---|---|
| 1/5 | R-b |
| 2/5 | |
| 3/5 | R-b |
| 4/5 | R-b |
| 5/5 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/5] mmc: misc fixes across MMC/SDHCI/RPMB
Patches 1-4 are straightforward single-site fixes found through code review. Patch 5 fixes a regression introduced by commit 906ee6785b1 ("mmc: sd: Handle UHS-I voltage signaling without power cycle").
1. mmc_poll_for_busy() can return a false -ETIMEDOUT if the card becomes ready on the exact iteration where the timeout counter reaches zero. Fix by returning 0 directly on card-ready.
2. rpmb_route_frames() has a tautological condition "req_cnt != 1 || !req_cnt" in the RPMB_REQ_READ_DATA case. The second operand is dead code. Based on the pattern of the other cases, this should be "req_cnt != 1 || !rsp_cnt" to validate the response count.
3. sdhci_init() allocates a 512KB aligned bounce buffer on every call without checking if one was already allocated, leaking memory on re-initialization in the non-DM code path.
4. mmc_bwrite() uses mmc->cfg->b_max directly instead of calling mmc_get_b_max(), which the read path (mmc_bread) uses. This means host drivers that implement get_b_max() for DMA boundary constraints have those constraints ignored for writes.
5. mmc_deinit() strips all UHS capabilities before calling sd_select_mode_and_width(). After commit 906ee6785b1, that function detects cards already at 1.8V and enables UHS mode selection, but no UHS modes remain in the filtered caps. The non-UHS fallbacks (SD_HS, Legacy) require 3.3V which the card cannot revert to without a power cycle. Fix by preserving UHS_SDR12 as the minimum fallback when the card is at 1.8V.
---
Changes in v2:
- Add R-b for patch 3
- Update commit message and Simplify code logic for patch 5
- Link to v1: https://patch.msgid.link/[email protected]
---
Peng Fan (5):
mmc: fix mmc_poll_for_busy() false timeout when card is ready
mmc: rpmb: fix tautological condition in RPMB_REQ_READ_DATA validation
mmc: sdhci: fix align_buffer memory leak on re-initialization
mmc: fix mmc_bwrite() ignoring host get_b_max() callback
mmc: fix mmc_deinit regression when card is at 1.8V signaling
drivers/mmc/mmc.c | 29 +++++++++++++++++------------ drivers/mmc/mmc_private.h | 4 ++++ drivers/mmc/mmc_write.c | 6 ++++-- drivers/mmc/rpmb.c | 2 +- drivers/mmc/sdhci.c | 3 ++- 5 files changed, 28 insertions(+), 16 deletions(-)
---
base-commit: 6741b0dfb41dc82a284ab1cff4c58af6ef2f3f9c
change-id: 20260712-mmc-fix-cc14724541b8
Best regards,
Signature · 1 line
Peng Fan <[email protected]>