From: kishon@ti.com (Kishon Vijay Abraham I)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] phy: phy-sun4i-usb: Fix optional gpios failing probe
Date: Fri, 17 Jun 2016 18:54:16 +0530 [thread overview]
Message-ID: <5763FA00.8030205@ti.com> (raw)
In-Reply-To: <1465818348-29499-1-git-send-email-quentin.schulz@free-electrons.com>
On Monday 13 June 2016 05:15 PM, Quentin Schulz wrote:
> The interrupt 0 is not a valid interrupt number. In the event where the
> retrieval of the vbus-det gpio would return null, the gpiod_to_irq
> callback would return 0, while the current code makes the assumption
> that it is a valid interrupt, and would go on calling request_irq.
> Obviously, this would fail, preventing the driver from probing properly,
> while the vbus and id gpios are optional.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
applied, thanks.
-Kishon
> ---
> drivers/phy/phy-sun4i-usb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
> index bae54f7..45f01d6 100644
> --- a/drivers/phy/phy-sun4i-usb.c
> +++ b/drivers/phy/phy-sun4i-usb.c
> @@ -645,11 +645,11 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
>
> data->id_det_irq = gpiod_to_irq(data->id_det_gpio);
> data->vbus_det_irq = gpiod_to_irq(data->vbus_det_gpio);
> - if ((data->id_det_gpio && data->id_det_irq < 0) ||
> - (data->vbus_det_gpio && data->vbus_det_irq < 0))
> + if ((data->id_det_gpio && data->id_det_irq <= 0) ||
> + (data->vbus_det_gpio && data->vbus_det_irq <= 0))
> data->phy0_poll = true;
>
> - if (data->id_det_irq >= 0) {
> + if (data->id_det_irq > 0) {
> ret = devm_request_irq(dev, data->id_det_irq,
> sun4i_usb_phy0_id_vbus_det_irq,
> IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
> @@ -660,7 +660,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
> }
> }
>
> - if (data->vbus_det_irq >= 0) {
> + if (data->vbus_det_irq > 0) {
> ret = devm_request_irq(dev, data->vbus_det_irq,
> sun4i_usb_phy0_id_vbus_det_irq,
> IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
>
WARNING: multiple messages have this Message-ID (diff)
From: Kishon Vijay Abraham I <kishon@ti.com>
To: Quentin Schulz <quentin.schulz@free-electrons.com>,
<maxime.ripard@free-electrons.com>, <wens@csie.org>
Cc: <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<thomas.petazzoni@free-electrons.com>
Subject: Re: [PATCH] phy: phy-sun4i-usb: Fix optional gpios failing probe
Date: Fri, 17 Jun 2016 18:54:16 +0530 [thread overview]
Message-ID: <5763FA00.8030205@ti.com> (raw)
In-Reply-To: <1465818348-29499-1-git-send-email-quentin.schulz@free-electrons.com>
On Monday 13 June 2016 05:15 PM, Quentin Schulz wrote:
> The interrupt 0 is not a valid interrupt number. In the event where the
> retrieval of the vbus-det gpio would return null, the gpiod_to_irq
> callback would return 0, while the current code makes the assumption
> that it is a valid interrupt, and would go on calling request_irq.
> Obviously, this would fail, preventing the driver from probing properly,
> while the vbus and id gpios are optional.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
applied, thanks.
-Kishon
> ---
> drivers/phy/phy-sun4i-usb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c
> index bae54f7..45f01d6 100644
> --- a/drivers/phy/phy-sun4i-usb.c
> +++ b/drivers/phy/phy-sun4i-usb.c
> @@ -645,11 +645,11 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
>
> data->id_det_irq = gpiod_to_irq(data->id_det_gpio);
> data->vbus_det_irq = gpiod_to_irq(data->vbus_det_gpio);
> - if ((data->id_det_gpio && data->id_det_irq < 0) ||
> - (data->vbus_det_gpio && data->vbus_det_irq < 0))
> + if ((data->id_det_gpio && data->id_det_irq <= 0) ||
> + (data->vbus_det_gpio && data->vbus_det_irq <= 0))
> data->phy0_poll = true;
>
> - if (data->id_det_irq >= 0) {
> + if (data->id_det_irq > 0) {
> ret = devm_request_irq(dev, data->id_det_irq,
> sun4i_usb_phy0_id_vbus_det_irq,
> IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
> @@ -660,7 +660,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
> }
> }
>
> - if (data->vbus_det_irq >= 0) {
> + if (data->vbus_det_irq > 0) {
> ret = devm_request_irq(dev, data->vbus_det_irq,
> sun4i_usb_phy0_id_vbus_det_irq,
> IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
>
next prev parent reply other threads:[~2016-06-17 13:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 11:45 [PATCH] phy: phy-sun4i-usb: Fix optional gpios failing probe Quentin Schulz
2016-06-13 11:45 ` Quentin Schulz
2016-06-17 13:24 ` Kishon Vijay Abraham I [this message]
2016-06-17 13:24 ` Kishon Vijay Abraham I
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=5763FA00.8030205@ti.com \
--to=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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.