From dc1936211335eca00acca53d058dc94fbab02028 Mon Sep 17 00:00:00 2001 From: Linmao Li Date: Wed, 12 Aug 2026 14:07:38 +0800 Subject: [PATCH] wifi: mm81x: do not discard a failed firmware segment write 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 Link: https://patch.msgid.link/20260812060740.1275280-3-lilinmao@kylinos.cn Signed-off-by: Lachlan Hodges --- 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 d407b57f4c9c..a2cb97cefc4e 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; } } }