Skip to content

Commit

Permalink
wifi: plfxlc: remove redundant NULL-check for GCC 12
Browse files Browse the repository at this point in the history
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.

Acked-by: Kalle Valo <kvalo@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed May 23, 2022
1 parent 17155d5 commit 0c7ab95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/wireless/purelifi/plfxlc/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 0c7ab95

Please sign in to comment.