From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Sang-Heon Jeon <ekffu200098@gmail.com>
Cc: Julia.Lawall@inria.fr, cocci@inria.fr,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 16/36] Input: remove conditional return with no effect
Date: Fri, 24 Jul 2026 12:30:24 -0700 [thread overview]
Message-ID: <amO8lj_0sqBFOqub@google.com> (raw)
In-Reply-To: <20260723184538.3888637-17-ekffu200098@gmail.com>
On Fri, Jul 24, 2026 at 03:45:18AM +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@gmail.com>
> ---
> drivers/input/keyboard/pmic8xxx-keypad.c | 8 +-------
> drivers/input/mouse/synaptics_i2c.c | 6 +-----
> drivers/input/rmi4/rmi_smbus.c | 7 +------
> 3 files changed, 3 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c
> index 35d1aa2a22a5..c916e80e2f58 100644
> --- a/drivers/input/keyboard/pmic8xxx-keypad.c
> +++ b/drivers/input/keyboard/pmic8xxx-keypad.c
> @@ -462,15 +462,9 @@ static int pmic8xxx_kp_enable(struct pmic8xxx_kp *kp)
>
> static int pmic8xxx_kp_disable(struct pmic8xxx_kp *kp)
> {
> - int rc;
> -
> kp->ctrl_reg &= ~KEYP_CTRL_KEYP_EN;
>
> - rc = regmap_write(kp->regmap, KEYP_CTRL, kp->ctrl_reg);
> - if (rc < 0)
> - return rc;
> -
> - return rc;
> + return regmap_write(kp->regmap, KEYP_CTRL, kp->ctrl_reg);
This is fine.
> }
>
> static int pmic8xxx_kp_open(struct input_dev *dev)
> diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c
> index d4cf982f1263..85e37e2ce45b 100644
> --- a/drivers/input/mouse/synaptics_i2c.c
> +++ b/drivers/input/mouse/synaptics_i2c.c
> @@ -257,11 +257,7 @@ static s32 synaptics_i2c_reg_set(struct i2c_client *client, u16 reg, u8 val)
> if (error)
> return error;
>
> - error = i2c_smbus_write_byte_data(client, reg & 0xff, val);
> - if (error)
> - return error;
> -
> - return error;
> + return i2c_smbus_write_byte_data(client, reg & 0xff, val);
When there ate multiple failure points the preference is to explicitly
return 0 on success.
> }
>
> static s32 synaptics_i2c_word_get(struct i2c_client *client, u16 reg)
> diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c
> index 6de68c602558..3160714a514a 100644
> --- a/drivers/input/rmi4/rmi_smbus.c
> +++ b/drivers/input/rmi4/rmi_smbus.c
> @@ -177,13 +177,8 @@ static int smb_block_read(struct rmi_transport_dev *xport,
> struct rmi_smb_xport *rmi_smb =
> container_of(xport, struct rmi_smb_xport, xport);
> struct i2c_client *client = rmi_smb->client;
> - int retval;
>
> - retval = i2c_smbus_read_block_data(client, commandcode, buf);
> - if (retval < 0)
> - return retval;
> -
> - return retval;
> + return i2c_smbus_read_block_data(client, commandcode, buf);
This is fine too...
> }
>
> static int rmi_smb_read_block(struct rmi_transport_dev *xport, u16 rmiaddr,
Thanks.
--
Dmitry
next prev parent reply other threads:[~2026-07-24 19:30 UTC|newest]
Thread overview: 6+ 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 ` [PATCH 16/36] Input: remove conditional return " Sang-Heon Jeon
2026-07-24 19:30 ` Dmitry Torokhov [this message]
2026-07-25 7:28 ` sashiko-bot
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=amO8lj_0sqBFOqub@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=Julia.Lawall@inria.fr \
--cc=cocci@inria.fr \
--cc=ekffu200098@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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