[cocci] [PATCH 32/36] USB: serial: ch341: remove conditional return with no effect
Sang-Heon Jeon <[email protected]> Fri, 24 Jul 2026 03:45:34 +0900
| Newsgroups | fr.inria.cocci,org.kernel.vger.linux-kernel,org.kernel.vger.linux-usb |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> --- 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