mwifiex: don't leak 'chan_stats' on reset
authorBrian Norris <briannorris@chromium.org>
Fri, 14 Apr 2017 21:51:20 +0000 (14:51 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 24 Mar 2018 10:00:11 +0000 (11:00 +0100)
commitc1c0f99f4fab4ccc194a846693288b820404e833
tree1d73055f51a7b39722b39a89f8324b32bc8d30c8
parent90089934fce3a476d508c08bfb271f5ba19d6204
mwifiex: don't leak 'chan_stats' on reset

[ Upstream commit fb9e67bee3ab7111513130c516ffe378d885c0d0 ]

'chan_stats' is (re)allocated in _mwifiex_fw_dpc() ->
mwifiex_init_channel_scan_gap(), which is called whenever the device is
initialized -- at probe or at reset.

But we only free it in we completely unregister the adapter, meaning we
leak a copy of it during every reset.

Let's free it in the shutdown / removal paths instead (and in the
error-handling path), to avoid the leak.

Ideally, we can eventually unify much of mwifiex_shutdown_sw() and
mwifiex_remove_card() (way too much copy-and-paste) to reduce the burden
on bugfixes like this. But that's work for tomorrow.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/marvell/mwifiex/main.c