diff mbox series

[net-next,1/8] wifi: plfxlc: remove redundant NULL-check for GCC 12

Message ID 20220520194320.2356236-2-kuba@kernel.org (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series Fix/silence GCC 12 warnings in drivers/net/wireless/ | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 2 this patch: 0
netdev/cc_maintainers warning 3 maintainers not CCed: davem@davemloft.net pabeni@redhat.com edumazet@google.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 2 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jakub Kicinski May 20, 2022, 7:43 p.m. UTC
GCC is upset that we check the return value of plfxlc_usb_dev()
even tho it can't be NULL:

drivers/net/wireless/purelifi/plfxlc/usb.c: In function ‘resume’:
drivers/net/wireless/purelifi/plfxlc/usb.c:840:20: warning: the comparison will always evaluate as ‘true’ for the address of ‘dev’ will never be NULL [-Waddress]
  840 |         if (!pl || !plfxlc_usb_dev(pl))
      |                    ^

plfxlc_usb_dev() returns an address of one of the members of pl,
so it's safe to drop these checks.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: srini.raju@purelifi.com
CC: kvalo@kernel.org
CC: linux-wireless@vger.kernel.org
---
 drivers/net/wireless/purelifi/plfxlc/usb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/purelifi/plfxlc/usb.c b/drivers/net/wireless/purelifi/plfxlc/usb.c
index d0e98b2f1365..8519cf0adfff 100644
--- a/drivers/net/wireless/purelifi/plfxlc/usb.c
+++ b/drivers/net/wireless/purelifi/plfxlc/usb.c
@@ -824,7 +824,7 @@  static int suspend(struct usb_interface *interface,
 	struct plfxlc_usb *pl = get_plfxlc_usb(interface);
 	struct plfxlc_mac *mac = plfxlc_usb_to_mac(pl);
 
-	if (!pl || !plfxlc_usb_dev(pl))
+	if (!pl)
 		return -ENODEV;
 	if (pl->initialized == 0)
 		return 0;
@@ -837,7 +837,7 @@  static int resume(struct usb_interface *interface)
 {
 	struct plfxlc_usb *pl = get_plfxlc_usb(interface);
 
-	if (!pl || !plfxlc_usb_dev(pl))
+	if (!pl)
 		return -ENODEV;
 	if (pl->was_running)
 		plfxlc_usb_resume(pl);