Commit 29d1e720 authored by Richard Weinberger's avatar Richard Weinberger Committed by Greg Kroah-Hartman

staging/rtl8821ae: Fix OOM handling in _rtl_init_deferred_work()

alloc_workqueue() can fail, handle this case.
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c9eaa447
...@@ -388,7 +388,7 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw) ...@@ -388,7 +388,7 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
} }
static void _rtl_init_deferred_work(struct ieee80211_hw *hw) static int _rtl_init_deferred_work(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
...@@ -410,6 +410,9 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) ...@@ -410,6 +410,9 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
rtlpriv->works.rtl_wq = create_workqueue(rtlpriv->cfg->name); rtlpriv->works.rtl_wq = create_workqueue(rtlpriv->cfg->name);
#endif #endif
/*<delete in kernel end>*/ /*<delete in kernel end>*/
if (!rtlpriv->works.rtl_wq)
return -ENOMEM;
INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq,
(void *)rtl_watchdog_wq_callback); (void *)rtl_watchdog_wq_callback);
INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq,
...@@ -421,6 +424,8 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) ...@@ -421,6 +424,8 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq,
(void *)rtl_fwevt_wq_callback); (void *)rtl_fwevt_wq_callback);
return 0;
} }
void rtl_deinit_deferred_work(struct ieee80211_hw *hw) void rtl_deinit_deferred_work(struct ieee80211_hw *hw)
...@@ -519,7 +524,8 @@ int rtl_init_core(struct ieee80211_hw *hw) ...@@ -519,7 +524,8 @@ int rtl_init_core(struct ieee80211_hw *hw)
INIT_LIST_HEAD(&rtlpriv->entry_list); INIT_LIST_HEAD(&rtlpriv->entry_list);
/* <6> init deferred work */ /* <6> init deferred work */
_rtl_init_deferred_work(hw); if (_rtl_init_deferred_work(hw))
return 1;
/* <7> */ /* <7> */
#ifdef VIF_TODO #ifdef VIF_TODO
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment