linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: mcp251xfd: remove useless code in mcp251xfd_chip_softreset
@ 2020-11-17  9:29 xiakaixu1987
  2020-11-17 10:05 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: xiakaixu1987 @ 2020-11-17  9:29 UTC (permalink / raw)
  To: mkl, manivannan.sadhasivam, thomas.kopp, wg, kuba
  Cc: linux-can, netdev, linux-kernel, Kaixu Xia

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(-)

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)
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] can: mcp251xfd: remove useless code in mcp251xfd_chip_softreset
  2020-11-17  9:29 [PATCH] can: mcp251xfd: remove useless code in mcp251xfd_chip_softreset xiakaixu1987
@ 2020-11-17 10:05 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2020-11-17 10:05 UTC (permalink / raw)
  To: xiakaixu1987
  Cc: manivannan.sadhasivam, thomas.kopp, wg, kuba, linux-can, netdev,
	linux-kernel, Kaixu Xia

[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

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

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-17 10:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17  9:29 [PATCH] can: mcp251xfd: remove useless code in mcp251xfd_chip_softreset xiakaixu1987
2020-11-17 10:05 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).