Skip to contentSkip to conversation

net: ax88796c: fix -Wpointer-bool-conversion warning

PATCH In review Arnd Bergmann 2 participants 2 messages Oct 26, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ax88796c: fix -Wpointer-bool-conversion warning

From: Arnd Bergmann <[email protected]>

ax_local->phydev->advertising is an array, not a pointer, so clang points out that checking for NULL is unnecessary:

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 &&
            ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ ~~
Fixes a97c69ba4f30 ("net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver")
---
 drivers/net/ethernet/asix/ax88796c_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/asix/ax88796c_main.c +4 -5
index cfc597f72e3d..846a04922561 100644
@@ -848,11 +848,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,
Signature · 1 line
2.29.2
maintainer
#1 lore raw
Quoted 25 lines · On Tue, 26 Oct 2021 21:56:39 +0200 Arnd Bergmann wrote:

From: Arnd Bergmann <[email protected]>

ax_local->phydev->advertising is an array, not a pointer, so clang points out that checking for NULL is unnecessary:

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 &&
            ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ ~~
Fixes a97c69ba4f30 ("net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver")
---
 drivers/net/ethernet/asix/ax88796c_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/asix/ax88796c_main.c +0 -2
index cfc597f72e3d..846a04922561 100644
@@ -848,11 +848,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,

drivers/net/ethernet/asix/ax88796c_main.c ax88796c_open(struct net_device *ndev) · line 857

Quoted 10 lines
drivers/net/ethernet/asix/ax88796c_main.c +4 -3
-			       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,

Same as 971f5c4079ed46a131ad3ac6e684ed056a7777da in net-next, thanks.