[PATCH do not merge 1/4] wifi: mwifiex: release firmware at remove time
From: Sascha Hauer
Date: Wed Mar 26 2025 - 08:21:18 EST
With VDLL support the device will request parts of the firmware during
runtime, so instead of releasing the firmware immediately after initial
firmware upload, release it during device deregistration.
FIXME: I am not sure if we run into trouble with the firmware framework
when we don't release the firmware. We might have to copy it over to
some private buffer instead of just keeping it around.
FIXME: we might want to limit the release firmware at remove time to the
devices that actually need it.
Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
drivers/net/wireless/marvell/mwifiex/main.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index 855019fe54858..0b394ea261316 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -695,10 +695,6 @@ static int _mwifiex_fw_dpc(const struct firmware *firmware, void *context)
release_firmware(adapter->cal_data);
adapter->cal_data = NULL;
}
- if (adapter->firmware) {
- release_firmware(adapter->firmware);
- adapter->firmware = NULL;
- }
if (init_failed) {
if (adapter->irq_wakeup >= 0)
device_init_wakeup(adapter->dev, false);
@@ -1836,6 +1832,11 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter)
"info: unregister device\n");
if (adapter->if_ops.unregister_dev)
adapter->if_ops.unregister_dev(adapter);
+ if (adapter->firmware) {
+ release_firmware(adapter->firmware);
+ adapter->firmware = NULL;
+ }
+
/* Free adapter structure */
mwifiex_dbg(adapter, INFO,
"info: free adapter\n");
--
2.39.5