All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Hennerich <michael.hennerich@analog.com>
To: Pramod Gurav <pramod.gurav@smartplayin.com>,
	linux-kernel@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>, linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: adp5588-keys: cancel workqueue in failure path
Date: Tue, 7 Oct 2014 14:42:40 +0200	[thread overview]
Message-ID: <5433DFC0.705@analog.com> (raw)
In-Reply-To: <1412667049-6128-1-git-send-email-pramod.gurav@smartplayin.com>

On 10/07/2014 09:30 AM, Pramod Gurav wrote:
> This change introduces a label to call cancel_delayed_work_sync in
> failure path.
>
> Cc: Michael Hennerich <michael.hennerich@analog.com>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>

The interrupt triggers the work queue. adp5588_setup() enable the HW 
interrupt.
Only if the device was configured before, without being resetb -
The earliest point in time where a problem could happen - is after the 
request_irq().

Anyways patch below doesn't harm and fixes a potential problem.

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>   drivers/input/keyboard/adp5588-keys.c |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
> index 5ef7fcf..b494062 100644
> --- a/drivers/input/keyboard/adp5588-keys.c
> +++ b/drivers/input/keyboard/adp5588-keys.c
> @@ -559,7 +559,7 @@ static int adp5588_probe(struct i2c_client *client,
>   	error = input_register_device(input);
>   	if (error) {
>   		dev_err(&client->dev, "unable to register input device\n");
> -		goto err_free_mem;
> +		goto err_delayed_work;
>   	}
>   
>   	error = request_irq(client->irq, adp5588_irq,
> @@ -592,6 +592,8 @@ static int adp5588_probe(struct i2c_client *client,
>    err_unreg_dev:
>   	input_unregister_device(input);
>   	input = NULL;
> + err_delayed_work:
> +	cancel_delayed_work_sync(&kpad->work);
>    err_free_mem:
>   	input_free_device(input);
>   	kfree(kpad);


-- 
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif


WARNING: multiple messages have this Message-ID (diff)
From: Michael Hennerich <michael.hennerich@analog.com>
To: Pramod Gurav <pramod.gurav@smartplayin.com>,
	<linux-kernel@vger.kernel.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	<linux-input@vger.kernel.org>
Subject: Re: [PATCH] Input: adp5588-keys: cancel workqueue in failure path
Date: Tue, 7 Oct 2014 14:42:40 +0200	[thread overview]
Message-ID: <5433DFC0.705@analog.com> (raw)
In-Reply-To: <1412667049-6128-1-git-send-email-pramod.gurav@smartplayin.com>

On 10/07/2014 09:30 AM, Pramod Gurav wrote:
> This change introduces a label to call cancel_delayed_work_sync in
> failure path.
>
> Cc: Michael Hennerich <michael.hennerich@analog.com>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>

The interrupt triggers the work queue. adp5588_setup() enable the HW 
interrupt.
Only if the device was configured before, without being resetb -
The earliest point in time where a problem could happen - is after the 
request_irq().

Anyways patch below doesn't harm and fixes a potential problem.

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>   drivers/input/keyboard/adp5588-keys.c |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
> index 5ef7fcf..b494062 100644
> --- a/drivers/input/keyboard/adp5588-keys.c
> +++ b/drivers/input/keyboard/adp5588-keys.c
> @@ -559,7 +559,7 @@ static int adp5588_probe(struct i2c_client *client,
>   	error = input_register_device(input);
>   	if (error) {
>   		dev_err(&client->dev, "unable to register input device\n");
> -		goto err_free_mem;
> +		goto err_delayed_work;
>   	}
>   
>   	error = request_irq(client->irq, adp5588_irq,
> @@ -592,6 +592,8 @@ static int adp5588_probe(struct i2c_client *client,
>    err_unreg_dev:
>   	input_unregister_device(input);
>   	input = NULL;
> + err_delayed_work:
> +	cancel_delayed_work_sync(&kpad->work);
>    err_free_mem:
>   	input_free_device(input);
>   	kfree(kpad);


-- 
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif


  reply	other threads:[~2014-10-07 14:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07  7:30 [PATCH] Input: adp5588-keys: cancel workqueue in failure path Pramod Gurav
2014-10-07 12:42 ` Michael Hennerich [this message]
2014-10-07 12:42   ` Michael Hennerich
2014-10-07 16:38 ` Dmitry Torokhov
2014-10-08 10:18   ` Pramod Gurav
2014-10-08 10:25     ` Pramod Gurav

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=5433DFC0.705@analog.com \
    --to=michael.hennerich@analog.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pramod.gurav@smartplayin.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.