Re: [PATCH] rtlwifi: Remove unnecessary NULL check in rtl_regd_init

From: Kalle Valo
Date: Thu Oct 24 2019 - 01:47:41 EST


Nathan Chancellor <natechancellor@xxxxxxxxx> wrote:

> 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 f986978b32b3 ("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: 0c8173385e54 ("rtl8192ce: Add new driver")
> Link:https://github.com/ClangBuiltLinux/linux/issues/750
> Signed-off-by: Nathan Chancellor <natechancellor@xxxxxxxxx>
> Acked-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx>

Patch applied to wireless-drivers-next.git, thanks.

091c6e9c083f rtlwifi: Remove unnecessary NULL check in rtl_regd_init

--
https://patchwork.kernel.org/patch/11205577/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches