diff mbox

[1/3] cfg80211: fix incorrect checking of return value

Message ID 338500f76d74ed1a62249f719024e8bbc5120790.1397924746.git.gamerh2o@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Gang ZHAO April 19, 2014, 4:32 p.m. UTC
Since cfg80211_chandef_dfs_required() can return error number(e.g.,
-EINVAL), it's not sufficient to just check if it didn't return zero.

Fixes: 9e0e29615a20 ("cfg80211: consider existing DFS interfaces")
Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
---
 net/wireless/chan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 9c9501a..2cfff9e 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -744,7 +744,7 @@  cfg80211_get_chan_state(struct wireless_dev *wdev,
 			*chanmode = CHAN_MODE_SHARED;
 
 			if (cfg80211_chandef_dfs_required(wdev->wiphy,
-							  &wdev->chandef))
+							  &wdev->chandef) > 0)
 				*radar_detect |= BIT(wdev->chandef.width);
 		}
 		return;
@@ -754,7 +754,7 @@  cfg80211_get_chan_state(struct wireless_dev *wdev,
 			*chanmode = CHAN_MODE_SHARED;
 
 			if (cfg80211_chandef_dfs_required(wdev->wiphy,
-							  &wdev->chandef))
+							  &wdev->chandef) > 0)
 				*radar_detect |= BIT(wdev->chandef.width);
 		}
 		return;