Skip to content

Commit 4a0467e

Browse files
sudipm-mukherjeedtor
authored andcommitted
Input: zforce_ts - use devm_add_action_or_reset()
If devm_add_action() fails we are explicitly calling the cleanup to free the resources allocated. Lets use the helper devm_add_action_or_reset() and return directly in case of error, as we know that the cleanup function has been already called by the helper if there was any error. Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Andreas Kemnade <andreas@kemnade.info> # Tolino Shine2HD Link: https://lore.kernel.org/r/20240824055047.1706392-2-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 78af00d commit 4a0467e

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

drivers/input/touchscreen/zforce_ts.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -803,15 +803,12 @@ static int zforce_probe(struct i2c_client *client)
803803
udelay(100);
804804
}
805805

806-
ret = devm_add_action(&client->dev, zforce_reset, ts);
806+
ret = devm_add_action_or_reset(&client->dev, zforce_reset, ts);
807807
if (ret) {
808808
dev_err(&client->dev, "failed to register reset action, %d\n",
809809
ret);
810810

811811
/* hereafter the regulator will be disabled by the action */
812-
if (!IS_ERR(ts->reg_vdd))
813-
regulator_disable(ts->reg_vdd);
814-
815812
return ret;
816813
}
817814

0 commit comments

Comments
 (0)