[PATCH v2 0/3] scsi: mpi3mr: Fix error return, start_time, and timeout check in mpi3mr_bring_ioc_ready()

From: Ian Rogers

Date: Fri Nov 20 2026 - 14:01:12 EST


Split the mpi3mr_bring_ioc_ready() error-handling and retry fixes into
three independent patches with individual Fixes: tags as requested by
Laurence Oberman:

1. Return -1 instead of 0 on failure exits in mpi3mr_bring_ioc_ready()
when retval is 0 (such as unrecoverable controller faults, hot-unplug
during reset/diag-save waits, or ready-state faults and timeouts
after mpi3mr_setup_admin_qpair() sets retval = 0).
2. Initialize start_time = jiffies on entry and guard the post-enable
timestamp reset with a boolean flag so pre-enable failures and
subsequent retries never read an uninitialized start_time.
3. Rewrite 'elapsed_time_sec < (mrioc->ready_timeout - 60)' as
'elapsed_time_sec + 60 < mrioc->ready_timeout' to avoid 32-bit
unsigned underflow if a controller reports ready_timeout < 60.

v2:
- Split v1 into three patches, each with its own Fixes: tag (Laurence
Oberman).
- Move 'if (!retval) retval = -1;' to 'out_device_not_present:' in
patch 1 so a single hunk covers both out_failed fallthroughs and
early out_device_not_present jumps cleanly for stable backports.
- Add Laurence's Reviewed-by tag on patches 1 and 2, and note the
510s (570s - 60s) firmware timeout math from commit 9634bb07083c in
patch 3.

v1: https://lore.kernel.org/r/20261119170900.1530138-1-irogers@xxxxxxxxxx

Ian Rogers (3):
scsi: mpi3mr: Return error on all failure exits in
mpi3mr_bring_ioc_ready()
scsi: mpi3mr: Initialize start_time on all paths in
mpi3mr_bring_ioc_ready()
scsi: mpi3mr: Avoid ready_timeout underflow in
mpi3mr_bring_ioc_ready()

drivers/scsi/mpi3mr/mpi3mr_fw.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

--
2.56.1.750.gf70dc682cf-goog