wlcore: Fix memory leak in wlcore_cmd_wait_for_event_or_timeout

In case memory resources for *events_vector* were allocated, release
them before return.

Addresses-Coverity-ID: 1470194 ("Resource leak")
Fixes: 4ec7cece87 ("wlcore: Add missing PM call for wlcore_cmd_wait_for_event_or_timeout()")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Gustavo A. R. Silva 2018-06-28 08:08:09 -05:00 коммит произвёл Kalle Valo
Родитель 7444a80929
Коммит 04614fe46f
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -195,8 +195,7 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
ret = pm_runtime_get_sync(wl->dev); ret = pm_runtime_get_sync(wl->dev);
if (ret < 0) { if (ret < 0) {
pm_runtime_put_noidle(wl->dev); pm_runtime_put_noidle(wl->dev);
goto free_vector;
return ret;
} }
do { do {
@ -232,6 +231,7 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
out: out:
pm_runtime_mark_last_busy(wl->dev); pm_runtime_mark_last_busy(wl->dev);
pm_runtime_put_autosuspend(wl->dev); pm_runtime_put_autosuspend(wl->dev);
free_vector:
kfree(events_vector); kfree(events_vector);
return ret; return ret;
} }