Linux USB
 help / color / mirror / Atom feed
From: Sang-Heon Jeon <ekffu200098@gmail.com>
To: Julia.Lawall@inria.fr, Johan Hovold <johan@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: cocci@inria.fr, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: [PATCH 32/36] USB: serial: ch341: remove conditional return with no effect
Date: Fri, 24 Jul 2026 03:45:34 +0900	[thread overview]
Message-ID: <20260723184538.3888637-33-ekffu200098@gmail.com> (raw)
In-Reply-To: <20260723184538.3888637-1-ekffu200098@gmail.com>

Both branches of the check return the same value, so the check has
no effect. Remove it and return the value directly.

This is the result of running the Coccinelle script from
scripts/coccinelle/misc/cond_return_no_effect.cocci.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 drivers/usb/serial/ch341.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 569f4aede215..3de317bde07b 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -279,12 +279,8 @@ static int ch341_set_baudrate_lcr(struct usb_device *dev,
 	if (priv->version < 0x30)
 		return 0;
 
-	r = ch341_control_out(dev, CH341_REQ_WRITE_REG,
-			      CH341_REG_LCR2 << 8 | CH341_REG_LCR, lcr);
-	if (r)
-		return r;
-
-	return r;
+	return ch341_control_out(dev, CH341_REQ_WRITE_REG,
+				 CH341_REG_LCR2 << 8 | CH341_REG_LCR, lcr);
 }
 
 static int ch341_set_handshake(struct usb_device *dev, u8 control)
-- 
2.43.0


  reply	other threads:[~2026-07-23 18:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 18:45 [PATCH 00/36] treewide: remove conditional returns with no effect Sang-Heon Jeon
2026-07-23 18:45 ` Sang-Heon Jeon [this message]
2026-07-23 18:45 ` [PATCH 33/36] usb: typec: fusb302: remove conditional return " Sang-Heon Jeon
2026-07-24 21:48 ` [PATCH 00/36] treewide: remove conditional returns " Jakub Kicinski
2026-07-24 23:35 ` (subset) " Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260723184538.3888637-33-ekffu200098@gmail.com \
    --to=ekffu200098@gmail.com \
    --cc=Julia.Lawall@inria.fr \
    --cc=cocci@inria.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox