[cocci] [PATCH 33/36] usb: typec: fusb302: remove conditional return with no effect
Sang-Heon Jeon <[email protected]> Fri, 24 Jul 2026 03:45:35 +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/typec/tcpm/fusb302.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c index 3319f6a2b0c9..d0ab247b24bf 100644 --- a/drivers/usb/typec/tcpm/fusb302.c +++ b/drivers/usb/typec/tcpm/fusb302.c @@ -314,11 +314,7 @@ static int fusb302_i2c_mask_write(struct fusb302_chip *chip, u8 address, return ret; data &= ~mask; data |= value; - ret = fusb302_i2c_write(chip, address, data); - if (ret < 0) - return ret; - - return ret; + return fusb302_i2c_write(chip, address, data); } static int fusb302_i2c_set_bits(struct fusb302_chip *chip, u8 address, @@ -375,12 +371,8 @@ static int fusb302_init_interrupt(struct fusb302_chip *chip) ret = fusb302_i2c_write(chip, FUSB_REG_MASKB, 0xFF); if (ret < 0) return ret; - ret = fusb302_i2c_clear_bits(chip, FUSB_REG_CONTROL0, - FUSB_REG_CONTROL0_INT_MASK); - if (ret < 0) - return ret; - - return ret; + return fusb302_i2c_clear_bits(chip, FUSB_REG_CONTROL0, + FUSB_REG_CONTROL0_INT_MASK); } static int fusb302_set_power_mode(struct fusb302_chip *chip, u8 power_mode) -- 2.43.0