iwlwifi: fix thermal throttling related power management operation
authorWey-Yi Guy <wey-yi.w.guy@intel.com>
Fri, 6 Aug 2010 19:39:14 +0000 (12:39 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 24 Aug 2010 20:28:19 +0000 (16:28 -0400)
The current approach is very broken because it adds an
often-used code path that will not initialise "cmd" at all.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Shanyu Zhao <shanyu.zhao.intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-power.c

index da1f2ae244721f5c68bfe0737d814e3a3f27173d..63c0ab46261faa105a7a20419b1d7cab899d2dc8 100644 (file)
@@ -284,13 +284,11 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force)
                 priv->hw->conf.flags & IEEE80211_CONF_IDLE)
                iwl_static_sleep_cmd(priv, &cmd, IWL_POWER_INDEX_5, 20);
        else if (priv->cfg->ops->lib->tt_ops.lower_power_detection &&
-                priv->cfg->ops->lib->tt_ops.tt_power_mode) {
-               if (priv->cfg->ops->lib->tt_ops.lower_power_detection(priv)) {
-                       /* in thermal throttling low power state */
-                       iwl_static_sleep_cmd(priv, &cmd,
-                           priv->cfg->ops->lib->tt_ops.tt_power_mode(priv),
-                           dtimper);
-               }
+                priv->cfg->ops->lib->tt_ops.tt_power_mode &&
+                priv->cfg->ops->lib->tt_ops.lower_power_detection(priv)) {
+               /* in thermal throttling low power state */
+               iwl_static_sleep_cmd(priv, &cmd,
+                   priv->cfg->ops->lib->tt_ops.tt_power_mode(priv), dtimper);
        } else if (!enabled)
                iwl_power_sleep_cam_cmd(priv, &cmd);
        else if (priv->power_data.debug_sleep_level_override >= 0)