himci: one place to give the transfer back - #62
Merged
widgetii merged 1 commit intoSep 22, 2026
Merged
Conversation
The follow-up promised when the FIFO-reset timeout was fixed.
himci_setup_data() maps the scatterlist and takes host->data.
himci_data_done() is the only thing that returns either, and it runs only on
the path where the data phase actually completed. Every other way out of
himci_request() with a transfer set up left the buffer mapped for the device
and host->data pointing at a request that was about to be completed:
- a data size larger than the descriptor table can hold
- a set-block-count command that could not be sent, or timed out
- the command itself failing to go out
- the command completing with an error, on both the tuning and the
ordinary branch
himci_finish_request() clears host->data without unmapping, which is exactly
why none of this showed up: the pointer looked tidy afterwards and the mapping
was gone for good.
Unwinding at request_end rather than at each site means the next path added
cannot forget it, and it subsumes the explicit call the FIFO-reset fix needed,
so there is one mechanism instead of two. host->data is already NULL when the
data phase completed normally, so a healthy transfer is untouched -- which is
also why this changes nothing for a working card.
The error is filled in first because himci_data_done() reports a full transfer
when it finds none set, and nothing moved on any of these paths. Taking the
command's error where there is one keeps the pair coherent for the core, which
previously saw a data phase with no error and no bytes. Nothing reads
data_error_count -- it is incremented here and reset in the probe -- so
counting these does not change recovery behaviour.
Compile-tested against the board kernel config with CONFIG_HIMCI=y
(arm-openipc-linux toolchain, make drivers/mmc/host/himci/himci.o), no new
warnings. Not exercised: these are error paths that need a card that fails in
a particular way, and the test board has no serial console or altbootcmd, so
flashing a kernel onto it to reach them is not a trade worth making.
PR Summary by Qodohimci: Centralize failed transfer cleanup
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can route each action level your way: inline, summary, both, or drop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The follow-up promised in #57/#58/#59.
himci_setup_data()maps the scatterlist and takeshost->data.himci_data_done()is the only thing that returns either, and it runs only onthe path where the data phase actually completed. Every other way out of
himci_request()with a transfer set up left the buffer mapped for thedevice and
host->datapointing at a request about to be completed:branch
himci_finish_request()clearshost->datawithout unmapping, which isexactly why none of this showed up — the pointer looked tidy afterwards and the
mapping was gone for good.
Why at
request_endrather than at each siteSix
goto request_endsites can reach it with a transfer outstanding. Fixingthem one at a time is how the seventh gets forgotten. Unwinding once at
request_endalso subsumes the explicithimci_data_done()call theFIFO-reset fix needed, so there is one mechanism instead of two — that call is
removed here.
host->datais already NULL when the data phase completed normally, so ahealthy transfer is untouched. That is also the argument that this is safe:
for a working card the new block never runs.
The error assignment
himci_data_done()reports a full transfer when it finds no error set, andnothing moved on any of these paths — so the error is filled in first. Taking
the command's error where there is one keeps the pair coherent for the core,
which previously saw a data phase with no error and no bytes transferred.
Nothing reads
data_error_count— it is incremented atrequest_endand resetin the probe — so counting these does not change recovery behaviour. I checked
that before letting the assignment widen what increments it.
Testing
Compile-tested against the board kernel config with
CONFIG_HIMCI=y(arm-openipc-linux toolchain,
make drivers/mmc/host/himci/himci.o), no newwarnings.
Not exercised, and I would rather say so than imply otherwise. These are
error paths that need a card failing in a particular way. The test board has no
serial console and no
altbootcmd, so flashing a kernel onto it to reach themis not a trade worth making — the same reasoning as #57. What can be said is
that the healthy path does not enter the new block at all.