linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe RICARD <christophe.ricard@gmail.com>
To: Dmitry Torokhov <dtor@chromium.org>
Cc: Lauro Ramos Venancio <lauro.venancio@openbossa.org>,
	Aloisio Almeida Jr <aloisio.almeida@openbossa.org>,
	Samuel Ortiz <sameo@linux.intel.com>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-nfc@lists.01.org
Subject: Re: [PATCH] NFC: st21nfca: fix error handling of irq_of_parse_and_map
Date: Sat, 15 Nov 2014 21:48:51 +0100	[thread overview]
Message-ID: <20141115214851.182e9cb5@toffy-MacBookPro> (raw)
In-Reply-To: <20141114223224.GA1448@dtor-ws>

Hi Dmitry,

Thank you for your feedback.
A patch got already pushed earlier this month:
https://lists.01.org/pipermail/linux-nfc/2014-November/003123.html

The i2c-core is already running the i2c_of_parse_and_map function when
registering the slave device when using dts. This step got removed for
this reason. 

However, i will take into account your second point in order to report
devm_gpio_request_one instead of -ENODEV in a future patchset.

Best Regards
Christophe 

On Fri, 14 Nov 2014 14:32:24 -0800
Dmitry Torokhov <dtor@chromium.org> wrote:

> Return value of irq_of_parse_and_map() is unsigned int, with 0
> indicating failure, so testing for negative result never works.
> 
> Also report error returned by devm_gpio_request_one instead of
> clobbering it with -ENODEV.
> 
> Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
> ---
>  drivers/nfc/st21nfca/i2c.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/nfc/st21nfca/i2c.c b/drivers/nfc/st21nfca/i2c.c
> index 0ea756b..6d6d282 100644
> --- a/drivers/nfc/st21nfca/i2c.c
> +++ b/drivers/nfc/st21nfca/i2c.c
> @@ -531,20 +531,19 @@ static int
> st21nfca_hci_i2c_of_request_resources(struct i2c_client *client)
> "clf_enable"); if (r) {
>  		nfc_err(&client->dev, "Failed to request enable
> pin\n");
> -		return -ENODEV;
> +		return r;
>  	}
>  
>  	phy->gpio_ena = gpio;
>  
>  	/* IRQ */
> -	r = irq_of_parse_and_map(pp, 0);
> -	if (r < 0) {
> -		nfc_err(&client->dev, "Unable to get irq, error:
> %d\n", r);
> -		return r;
> +	client->irq = irq_of_parse_and_map(pp, 0);
> +	if (!client->irq) {
> +		nfc_err(&client->dev, "Unable to get irq\n");
> +		return -EINVAL;
>  	}
>  
>  	phy->irq_polarity = irq_get_trigger_type(r);
> -	client->irq = r;
>  
>  	return 0;
>  }


      reply	other threads:[~2014-11-15 20:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-14 22:32 [PATCH] NFC: st21nfca: fix error handling of irq_of_parse_and_map Dmitry Torokhov
2014-11-15 20:48 ` Christophe RICARD [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=20141115214851.182e9cb5@toffy-MacBookPro \
    --to=christophe.ricard@gmail.com \
    --cc=aloisio.almeida@openbossa.org \
    --cc=dtor@chromium.org \
    --cc=lauro.venancio@openbossa.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfc@lists.01.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sameo@linux.intel.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).