linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: snvs_pwrkey - use devm_add_action_or_reset
Date: Wed, 6 Jul 2016 10:59:16 -0700	[thread overview]
Message-ID: <20160706175916.GC5447@dtor-ws> (raw)
In-Reply-To: <1465742061-5360-1-git-send-email-sudipm.mukherjee@gmail.com>

On Sun, Jun 12, 2016 at 03:34:21PM +0100, Sudip Mukherjee wrote:
> If devm_add_action() fails we are printing the error message and
> returning but we have already setup a timer. Lets now use the helper
> devm_add_action_or_reset() and return and so in case of error the
> cleanup function will be called by the helper to delete the timer.
> 

We set up timer, that is correct, however the timer will not run so
there is no need to stop it.

Thanks.

> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
>  drivers/input/keyboard/snvs_pwrkey.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
> index 24a9f59..c301419 100644
> --- a/drivers/input/keyboard/snvs_pwrkey.c
> +++ b/drivers/input/keyboard/snvs_pwrkey.c
> @@ -150,7 +150,8 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
>  	input_set_capability(input, EV_KEY, pdata->keycode);
>  
>  	/* input customer action to cancel release timer */
> -	error = devm_add_action(&pdev->dev, imx_snvs_pwrkey_act, pdata);
> +	error = devm_add_action_or_reset(&pdev->dev,
> +					 imx_snvs_pwrkey_act, pdata);
>  	if (error) {
>  		dev_err(&pdev->dev, "failed to register remove action\n");
>  		return error;
> -- 
> 1.9.1
> 

-- 
Dmitry

      parent reply	other threads:[~2016-07-06 17:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-12 14:34 [PATCH] Input: snvs_pwrkey - use devm_add_action_or_reset Sudip Mukherjee
2016-07-03 20:37 ` Sudip Mukherjee
2016-07-06 17:59 ` Dmitry Torokhov [this message]

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=20160706175916.GC5447@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).