Re: [PATCH 33/36] usb: typec: fusb302: remove conditional return with no effect
From: Heikki Krogerus
Date: Mon Jul 27 2026 - 09:49:30 EST
On Fri, Jul 24, 2026 at 03:45:35AM +0900, Sang-Heon Jeon wrote:
> 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@xxxxxxxxx>
Reviewed-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> ---
> 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
--
heikki