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

Linmao Li <[email protected]>
Newsgroups org.kernel.vger.linux-wireless,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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 <[email protected]>
---
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.