Skip to content

Commit

Permalink
net: ax88796c: Remove pointless check in ax88796c_open()
Browse files Browse the repository at this point in the history
Clang warns:

drivers/net/ethernet/asix/ax88796c_main.c:851:24: error: address of
array 'ax_local->phydev->advertising' will always evaluate to 'true'
[-Werror,-Wpointer-bool-conversion]
        if (ax_local->phydev->advertising &&
            ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ ~~

advertising cannot be NULL here if ax_local is not NULL, which cannot
happen due to the check in ax88796c_probe(). Remove the check.

Link: https://github.com/ClangBuiltLinux/linux/issues/1492
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Nathan Chancellor authored and David S. Miller committed Oct 26, 2021
1 parent 3c55488 commit 971f5c4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/net/ethernet/asix/ax88796c_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,11 +850,10 @@ ax88796c_open(struct net_device *ndev)
/* Setup flow-control configuration */
phy_support_asym_pause(ax_local->phydev);

if (ax_local->phydev->advertising &&
(linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
ax_local->phydev->advertising) ||
linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
ax_local->phydev->advertising)))
if (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
ax_local->phydev->advertising) ||
linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT,
ax_local->phydev->advertising))
fc |= AX_FC_ANEG;

fc |= linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT,
Expand Down

0 comments on commit 971f5c4

Please sign in to comment.