Re: [PATCH] mtd: rawnand: propagate timing-mode recovery failures
From: James Hilliard
Date: Wed Nov 18 2026 - 11:50:17 EST
On Wed, Nov 18, 2026 at 3:28 AM Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:
>
> On 03/11/2026 at 23:13:18 -07, James Hilliard <james.hilliard1@xxxxxxxxx> wrote:
>
> > When GET_FEATURES succeeds but the chip does not acknowledge the requested
> > timing mode, nand_setup_interface() falls back to mode 0. Both the
> > controller-interface reset and the NAND RESET command can fail, but their
> > return values are discarded. The function then returns the successful
> > GET_FEATURES status even though the fallback did not complete.
> >
> > Check the controller reset before issuing RESET and propagate either
> > recovery error when there was no earlier error. Preserve an earlier
> > GET_FEATURES failure and keep returning success when a timing mismatch
> > is recovered by a successful mode-0 fallback.
>
> You are carrying a return value in an error path of an error path. If
> the reset actually fails, the very next attempt will fail and probe will
> be aborted anyway. So while the fix is not inherently wrong, the title
> and commit log overstate the problem.
>
> My proposal:
>
> mtd: rawnand: propagate mode-0 fallback failures
>
> When a chip does not acknowledge the requested timing mode,
> nand_setup_interface() falls back to mode 0 by resetting the controller
> interface and issuing a NAND RESET. Either step can fail; returning
> success will likely lead to any later attempt at talking to the chip to
> fail.
>
> Make sure the error path propagates those failures in the mode-0
> fallback case.
There is also a caller outside probe: nand_do_write_oob() calls
nand_reset(), which calls nand_setup_interface(). If GET_FEATURES
reports a different timing mode and the fallback fails, nand_reset()
currently returns success and the OOB write continues past its reset
check. Propagating the fallback error lets the write stop there.
>
> Thanks,
> Miquèl