diff mbox series

[net-next] net: ks8851: Make ks8851_read_selftest() return void

Message ID 20210603165612.2088040-1-nathan@kernel.org (mailing list archive)
State Accepted
Commit 819fb78f695527fc015e0c93b23c6492f7257015
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: ks8851: Make ks8851_read_selftest() return void | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers fail 1 blamed authors not CCed: ben@simtec.co.uk; 5 maintainers not CCed: ben@simtec.co.uk michael@walle.cc marex@denx.de zhengyongjun3@huawei.com trix@redhat.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 34 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Nathan Chancellor June 3, 2021, 4:56 p.m. UTC
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")
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/net/ethernet/micrel/ks8851_common.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)


base-commit: 270d47dc1fc4756a0158778084a236bc83c156d2

Comments

Andrew Lunn June 3, 2021, 5:02 p.m. UTC | #1
On Thu, Jun 03, 2021 at 09:56:13AM -0700, Nathan Chancellor 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.
> 
> 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")
> Suggested-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
patchwork-bot+netdevbpf@kernel.org June 3, 2021, 10:30 p.m. UTC | #2
Hello:

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

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
diff mbox series

Patch

diff --git a/drivers/net/ethernet/micrel/ks8851_common.c b/drivers/net/ethernet/micrel/ks8851_common.c
index 13eef6e9bd2d..831518466de2 100644
--- a/drivers/net/ethernet/micrel/ks8851_common.c
+++ b/drivers/net/ethernet/micrel/ks8851_common.c
@@ -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 */