Commit 30b0e0ee authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

net: rtlwifi: properly check for alloc_workqueue() failure

If alloc_workqueue() fails, properly catch this and propagate the error
to the calling functions, so that the devuce initialization will
properly error out.

Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: Bryan Brattlof <hello@bryanbrattlof.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210503115736.2104747-14-gregkh@linuxfoundation.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 68c5634c
...@@ -440,9 +440,14 @@ static void rtl_watchdog_wq_callback(struct work_struct *work); ...@@ -440,9 +440,14 @@ static void rtl_watchdog_wq_callback(struct work_struct *work);
static void rtl_fwevt_wq_callback(struct work_struct *work); static void rtl_fwevt_wq_callback(struct work_struct *work);
static void rtl_c2hcmd_wq_callback(struct work_struct *work); static void rtl_c2hcmd_wq_callback(struct work_struct *work);
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);
struct workqueue_struct *wq;
wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name);
if (!wq)
return -ENOMEM;
/* <1> timer */ /* <1> timer */
timer_setup(&rtlpriv->works.watchdog_timer, timer_setup(&rtlpriv->works.watchdog_timer,
...@@ -451,7 +456,8 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) ...@@ -451,7 +456,8 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
rtl_easy_concurrent_retrytimer_callback, 0); rtl_easy_concurrent_retrytimer_callback, 0);
/* <2> work queue */ /* <2> work queue */
rtlpriv->works.hw = hw; rtlpriv->works.hw = hw;
rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); rtlpriv->works.rtl_wq = wq;
INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq,
rtl_watchdog_wq_callback); rtl_watchdog_wq_callback);
INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq,
...@@ -461,6 +467,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) ...@@ -461,6 +467,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
rtl_swlps_rfon_wq_callback); rtl_swlps_rfon_wq_callback);
INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, rtl_fwevt_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, rtl_fwevt_wq_callback);
INIT_DELAYED_WORK(&rtlpriv->works.c2hcmd_wq, rtl_c2hcmd_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.c2hcmd_wq, rtl_c2hcmd_wq_callback);
return 0;
} }
void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq) void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq)
...@@ -559,9 +566,7 @@ int rtl_init_core(struct ieee80211_hw *hw) ...@@ -559,9 +566,7 @@ int rtl_init_core(struct ieee80211_hw *hw)
rtlmac->link_state = MAC80211_NOLINK; rtlmac->link_state = MAC80211_NOLINK;
/* <6> init deferred work */ /* <6> init deferred work */
_rtl_init_deferred_work(hw); return _rtl_init_deferred_work(hw);
return 0;
} }
EXPORT_SYMBOL_GPL(rtl_init_core); EXPORT_SYMBOL_GPL(rtl_init_core);
......
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