* [PATCH v2 1/3] Input: pmic8xxx-keypad - remove conditional return with no effect
2026-07-29 17:09 [PATCH v2 0/3] Input: clean up conditional returns with no effect Sang-Heon Jeon
@ 2026-07-29 17:09 ` Sang-Heon Jeon
2026-07-29 17:09 ` [PATCH v2 2/3] Input: rmi_smbus " Sang-Heon Jeon
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-07-29 17:09 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
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 +-------
1 file changed, 1 insertion(+), 7 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);
}
static int pmic8xxx_kp_open(struct input_dev *dev)
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v2 2/3] Input: rmi_smbus - remove conditional return with no effect
2026-07-29 17:09 [PATCH v2 0/3] Input: clean up conditional returns with no effect Sang-Heon Jeon
2026-07-29 17:09 ` [PATCH v2 1/3] Input: pmic8xxx-keypad - remove conditional return " Sang-Heon Jeon
@ 2026-07-29 17:09 ` Sang-Heon Jeon
2026-07-29 17:09 ` [PATCH v2 3/3] Input: synaptics_i2c - return 0 explicitly on success Sang-Heon Jeon
2026-08-05 4:29 ` [PATCH v2 0/3] Input: clean up conditional returns with no effect Dmitry Torokhov
3 siblings, 0 replies; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-07-29 17:09 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
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/rmi4/rmi_smbus.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
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);
}
static int rmi_smb_read_block(struct rmi_transport_dev *xport, u16 rmiaddr,
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] Input: synaptics_i2c - return 0 explicitly on success
2026-07-29 17:09 [PATCH v2 0/3] Input: clean up conditional returns with no effect Sang-Heon Jeon
2026-07-29 17:09 ` [PATCH v2 1/3] Input: pmic8xxx-keypad - remove conditional return " Sang-Heon Jeon
2026-07-29 17:09 ` [PATCH v2 2/3] Input: rmi_smbus " Sang-Heon Jeon
@ 2026-07-29 17:09 ` Sang-Heon Jeon
2026-08-05 4:29 ` [PATCH v2 0/3] Input: clean up conditional returns with no effect Dmitry Torokhov
3 siblings, 0 replies; 5+ messages in thread
From: Sang-Heon Jeon @ 2026-07-29 17:09 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
error is always zero at the last return in synaptics_i2c_reg_set().
Explicitly return 0 on the success path instead of returning error,
which is the preferred way when there are multiple failure points.
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
drivers/input/mouse/synaptics_i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c
index d4cf982f1263..66e833974c6d 100644
--- a/drivers/input/mouse/synaptics_i2c.c
+++ b/drivers/input/mouse/synaptics_i2c.c
@@ -261,7 +261,7 @@ static s32 synaptics_i2c_reg_set(struct i2c_client *client, u16 reg, u8 val)
if (error)
return error;
- return error;
+ return 0;
}
static s32 synaptics_i2c_word_get(struct i2c_client *client, u16 reg)
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/3] Input: clean up conditional returns with no effect
2026-07-29 17:09 [PATCH v2 0/3] Input: clean up conditional returns with no effect Sang-Heon Jeon
` (2 preceding siblings ...)
2026-07-29 17:09 ` [PATCH v2 3/3] Input: synaptics_i2c - return 0 explicitly on success Sang-Heon Jeon
@ 2026-08-05 4:29 ` Dmitry Torokhov
3 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2026-08-05 4:29 UTC (permalink / raw)
To: Sang-Heon Jeon; +Cc: linux-input, linux-kernel
On Thu, Jul 30, 2026 at 02:09:32AM +0900, Sang-Heon Jeon wrote:
> Hello,
>
> This series cleans up conditional returns where both branches return
> the same value, so the check has no effect. The Input patch of the
> treewide v1 series [1] is split per driver and posted separately.
>
> Patches 1-2 are generated by the Coccinelle script, which you can
> find in v1.
>
> Patch 3 keeps the check in synaptics_i2c_reg_set() and returns 0
> explicitly instead, which is the preferred way when there are
> multiple failure points.
Applied the lot, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread