Re: [PATCH 29/33] Input: melfas_mip4 - Use devm_add_action_or_reset and other changes

From: Dmitry Torokhov
Date: Wed Jan 18 2017 - 14:28:24 EST


On Wed, Jan 18, 2017 at 09:46:50AM -0800, Guenter Roeck wrote:
> Replace devm_add_action() followed by failure action with
> devm_add_action_or_reset()
>
> This conversion was done automatically with coccinelle using the
> following semantic patches. The semantic patches and the scripts
> used to generate this commit log are available at
> https://github.com/groeck/coccinelle-patches
>
> - Replace devm_add_action() followed by failure action with
> devm_add_action_or_reset()

I am planning on using devm_sysfs_create_group() here (to be
[re]submitted to Greg).

> - Replace 'goto l; ... l: return e;' with 'return e;'
>
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> ---
> drivers/input/touchscreen/melfas_mip4.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c
> index 703d7f983d0a..3cad6f72dbf8 100644
> --- a/drivers/input/touchscreen/melfas_mip4.c
> +++ b/drivers/input/touchscreen/melfas_mip4.c
> @@ -594,7 +594,7 @@ static irqreturn_t mip4_interrupt(int irq, void *dev_id)
> if (error) {
> dev_err(&client->dev,
> "Failed to read packet info: %d\n", error);
> - goto out;
> + return IRQ_HANDLED;
> }
>
> size = ts->buf[0] & 0x7F;
> @@ -604,7 +604,7 @@ static irqreturn_t mip4_interrupt(int irq, void *dev_id)
> /* Check size */
> if (!size) {
> dev_err(&client->dev, "Empty packet\n");
> - goto out;
> + return IRQ_HANDLED;
> }
>
> /* Read packet data */
> @@ -614,7 +614,7 @@ static irqreturn_t mip4_interrupt(int irq, void *dev_id)
> if (error) {
> dev_err(&client->dev,
> "Failed to read packet data: %d\n", error);
> - goto out;
> + return IRQ_HANDLED;
> }
>
> if (alert) {
> @@ -629,7 +629,6 @@ static irqreturn_t mip4_interrupt(int irq, void *dev_id)
> input_sync(ts->input);
> }
>
> -out:
> return IRQ_HANDLED;
> }
>
> @@ -1531,9 +1530,8 @@ static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id)
> return error;
> }
>
> - error = devm_add_action(&client->dev, mip4_sysfs_remove, ts);
> + error = devm_add_action_or_reset(&client->dev, mip4_sysfs_remove, ts);
> if (error) {
> - mip4_sysfs_remove(ts);
> dev_err(&client->dev,
> "Failed to install sysfs remoce action: %d\n", error);
> return error;
> --
> 2.7.4
>

--
Dmitry