Skip to contentSkip to conversation

net: ks8851: Make ks8851_read_selftest() return void

PATCH Applied Nathan Chancellor 3 participants 3 messages Jun 3, 2021

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

PATCH 1/1 net: ks8851: Make ks8851_read_selftest() return void

clang points out that ret in ks8851_read_selftest() is set but unused:

drivers/net/ethernet/micrel/ks8851_common.c:1028:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]

        int ret = 0;
            ^

1 warning generated.

The return code of this function has never been checked so just remove ret and make the function return void.

Fixes 3ba81f3ece3c ("net: Micrel KS8851 SPI network driver")
---
 drivers/net/ethernet/micrel/ks8851_common.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/net/ethernet/micrel/ks8851_common.c +4 -11
index 13eef6e9bd2d..831518466de2 100644
@@ -1022,30 +1022,23 @@ static int ks8851_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 val)
  *
  * Read and check the TX/RX memory selftest information.
  */
-static int ks8851_read_selftest(struct ks8851_net *ks)
+static void ks8851_read_selftest(struct ks8851_net *ks)
 {
 	unsigned both_done = MBIR_TXMBF | MBIR_RXMBF;
-	int ret = 0;
 	unsigned rd;
 
 	rd = ks8851_rdreg16(ks, KS_MBIR);
 
 	if ((rd & both_done) != both_done) {
 		netdev_warn(ks->netdev, "Memory selftest not finished\n");
-		return 0;
+		return;
 	}
 
-	if (rd & MBIR_TXMBFA) {
+	if (rd & MBIR_TXMBFA)
 		netdev_err(ks->netdev, "TX memory selftest fail\n");
-		ret |= 1;
-	}
 
-	if (rd & MBIR_RXMBFA) {
+	if (rd & MBIR_RXMBFA)
 		netdev_err(ks->netdev, "RX memory selftest fail\n");
-		ret |= 2;
-	}
-
-	return 0;
 }
 
 /* driver bus management functions */

base-commit: 270d47dc1fc4756a0158778084a236bc83c156d2

Signature · 1 line
2.32.0.rc0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Nathan Chancellor

clang points out that ret in ks8851_read_selftest() is set but unused:

drivers/net/ethernet/micrel/ks8851_common.c:1028:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]

        int ret = 0;
            ^
Quoted 8 lines

1 warning generated.

The return code of this function has never been checked so just remove ret and make the function return void.

Fixes 3ba81f3ece3c ("net: Micrel KS8851 SPI network driver")

Andrew

#2 lore raw
In reply to Nathan Chancellor
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 9 lines · On Thu, 3 Jun 2021 09:56:13 -0700 you wrote:

clang points out that ret in ks8851_read_selftest() is set but unused:

drivers/net/ethernet/micrel/ks8851_common.c:1028:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]

        int ret = 0;
            ^

1 warning generated.

[...]

Here is the summary with links:
- [net-next] net: ks8851: Make ks8851_read_selftest() return void

    https://git.kernel.org/netdev/net-next/c/819fb78f6955

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html