Skip to content

Commit

Permalink
rtlwifi: Remove unnecessary NULL check in rtl_regd_init
Browse files Browse the repository at this point in the history
When building with Clang + -Wtautological-pointer-compare:

drivers/net/wireless/realtek/rtlwifi/regd.c:389:33: warning: comparison
of address of 'rtlpriv->regd' equal to a null pointer is always false
[-Wtautological-pointer-compare]
        if (wiphy == NULL || &rtlpriv->regd == NULL)
                              ~~~~~~~~~^~~~    ~~~~
1 warning generated.

The address of an array member is never NULL unless it is the first
struct member so remove the unnecessary check. This was addressed in
the staging version of the driver in commit f986978 ("Staging:
rtlwifi: remove unnecessary NULL check").

While we are here, fix the following checkpatch warning:

CHECK: Comparison to NULL could be written "!wiphy"
35: FILE: drivers/net/wireless/realtek/rtlwifi/regd.c:389:
+       if (wiphy == NULL)

Fixes: 0c81733 ("rtl8192ce: Add new driver")
Link:ClangBuiltLinux#750
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
nathanchance authored and Kalle Valo committed Oct 24, 2019
1 parent 082a36d commit 091c6e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/wireless/realtek/rtlwifi/regd.c
Expand Up @@ -386,7 +386,7 @@ int rtl_regd_init(struct ieee80211_hw *hw,
struct wiphy *wiphy = hw->wiphy;
struct country_code_to_enum_rd *country = NULL;

if (wiphy == NULL || &rtlpriv->regd == NULL)
if (!wiphy)
return -EINVAL;

/* init country_code from efuse channel plan */
Expand Down

0 comments on commit 091c6e9

Please sign in to comment.