[PATCH wireless-next 2/4] wifi: mm81x: do not discard a failed firmware segment write

From: Linmao Li

Date: Wed Aug 12 2026 - 02:12:47 EST


When mm81x_dm_write() fails while downloading a PT_LOAD segment,
mm81x_fw_load_fw() sets ret to -EIO and breaks out of the loop. The
boot address write at the end of the function then overwrites ret, so a
partially downloaded image is reported as loaded and the chip is
triggered on it instead of the load being retried.

Leave the function as soon as a segment fails.

Fixes: b1906cea00b0 ("wifi: mm81x: add mm81x Wi-Fi HaLow driver")
Signed-off-by: Linmao Li <lilinmao@xxxxxxxxxx>
---
drivers/net/wireless/morsemicro/mm81x/fw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/morsemicro/mm81x/fw.c b/drivers/net/wireless/morsemicro/mm81x/fw.c
index d407b57f4c9cb..a2cb97cefc4e9 100644
--- a/drivers/net/wireless/morsemicro/mm81x/fw.c
+++ b/drivers/net/wireless/morsemicro/mm81x/fw.c
@@ -162,7 +162,7 @@ static int mm81x_fw_load_fw(struct mm81x *mors, const struct firmware *fw)
mm81x_release_bus(mors);
if (status) {
ret = -EIO;
- break;
+ goto out_free;
}
}
}
--
2.25.1