diff mbox series

can: mcp251xfd: remove useless code in mcp251xfd_chip_softreset

Message ID 1605605352-25298-1-git-send-email-kaixuxia@tencent.com
State New
Headers show
Series can: mcp251xfd: remove useless code in mcp251xfd_chip_softreset | expand

Commit Message

xiakaixu1987@gmail.com Nov. 17, 2020, 9:29 a.m. UTC
From: Kaixu Xia <kaixuxia@tencent.com>

It would directly return if the variable err equals to 0 or other errors.
Only when the err equals to -ETIMEDOUT it can reach the 'if (err)'
statement, so the 'if (err)' and last 'return -ETIMEDOUT' statements are
useless. Romove them.

Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
 drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Marc Kleine-Budde Nov. 17, 2020, 10:05 a.m. UTC | #1
On Tue, Nov 17, 2020 at 05:29:12PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> It would directly return if the variable err equals to 0 or other errors.
> Only when the err equals to -ETIMEDOUT it can reach the 'if (err)'
> statement, so the 'if (err)' and last 'return -ETIMEDOUT' statements are
> useless. Romove them.
> 
> Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>

Applied to linux-can-next/testing.

Tnx,
Marc
diff mbox series

Patch

diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
index 9c215f7c5f81..ceae18270c01 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
@@ -644,10 +644,7 @@  static int mcp251xfd_chip_softreset(const struct mcp251xfd_priv *priv)
 		return 0;
 	}
 
-	if (err)
-		return err;
-
-	return -ETIMEDOUT;
+	return err;
 }
 
 static int mcp251xfd_chip_clock_init(const struct mcp251xfd_priv *priv)