2020-10-26 10:10:43

by Tang Bin

[permalink] [raw]
Subject: [PATCH] usb: host: ehci-tegra: Fix error handling in tegra_ehci_probe()

If the function platform_get_irq() failed, the negative value
returned will not be detected here. So fix error handling in
tegra_ehci_probe().

Fixes: 79ad3b5add4a ("usb: host: Add EHCI driver for NVIDIA Tegra SoCs")
Signed-off-by: Tang Bin <[email protected]>
---
drivers/usb/host/ehci-tegra.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 75a075daf..7b0efaf15 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -479,9 +479,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
u_phy->otg->host = hcd_to_bus(hcd);

irq = platform_get_irq(pdev, 0);
- if (!irq) {
- err = -ENODEV;
- goto cleanup_phy;
+ if (irq < 0) {
+ err = irq;
+ goto cleanup_phy;
}

otg_set_host(u_phy->otg, &hcd->self);
--
2.20.1.windows.1




2020-10-26 18:55:10

by Alan Stern

[permalink] [raw]
Subject: Re: [PATCH] usb: host: ehci-tegra: Fix error handling in tegra_ehci_probe()

On Mon, Oct 26, 2020 at 05:06:57PM +0800, Tang Bin wrote:
> If the function platform_get_irq() failed, the negative value
> returned will not be detected here. So fix error handling in
> tegra_ehci_probe().
>
> Fixes: 79ad3b5add4a ("usb: host: Add EHCI driver for NVIDIA Tegra SoCs")
> Signed-off-by: Tang Bin <[email protected]>
> ---
> drivers/usb/host/ehci-tegra.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
> index 75a075daf..7b0efaf15 100644
> --- a/drivers/usb/host/ehci-tegra.c
> +++ b/drivers/usb/host/ehci-tegra.c
> @@ -479,9 +479,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
> u_phy->otg->host = hcd_to_bus(hcd);
>
> irq = platform_get_irq(pdev, 0);
> - if (!irq) {
> - err = -ENODEV;
> - goto cleanup_phy;
> + if (irq < 0) {
> + err = irq;
> + goto cleanup_phy;
> }
>
> otg_set_host(u_phy->otg, &hcd->self);

Acked-by: Alan Stern <[email protected]>

The "if (!irq)" statement occurs at least one other driver in this
directory. Would you like to submit a patch for ehci-xilinx-of.c as
well?

Alan Stern

2020-10-27 19:23:29

by Tang Bin

[permalink] [raw]
Subject: Re: [PATCH] usb: host: ehci-tegra: Fix error handling integra_ehci_probe()

?? 2020/10/26 23:05, Alan Stern ะด??:
> On Mon, Oct 26, 2020 at 05:06:57PM +0800, Tang Bin wrote:
>> If the function platform_get_irq() failed, the negative value
>> returned will not be detected here. So fix error handling in
>> tegra_ehci_probe().
>>
>> Fixes: 79ad3b5add4a ("usb: host: Add EHCI driver for NVIDIA Tegra SoCs")
>> Signed-off-by: Tang Bin <[email protected]>
>> ---
>> drivers/usb/host/ehci-tegra.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
>> index 75a075daf..7b0efaf15 100644
>> --- a/drivers/usb/host/ehci-tegra.c
>> +++ b/drivers/usb/host/ehci-tegra.c
>> @@ -479,9 +479,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
>> u_phy->otg->host = hcd_to_bus(hcd);
>>
>> irq = platform_get_irq(pdev, 0);
>> - if (!irq) {
>> - err = -ENODEV;
>> - goto cleanup_phy;
>> + if (irq < 0) {
>> + err = irq;
>> + goto cleanup_phy;
>> }
>>
>> otg_set_host(u_phy->otg, &hcd->self);
> Acked-by: Alan Stern <[email protected]>
>
> The "if (!irq)" statement occurs at least one other driver in this
> directory. Would you like to submit a patch for ehci-xilinx-of.c as
> well?

OK, I will check this file out. Thanks!

Tang Bin



2020-10-28 07:43:05

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH] usb: host: ehci-tegra: Fix error handling in tegra_ehci_probe()

On Mon, Oct 26, 2020 at 05:06:57PM +0800, Tang Bin wrote:
> If the function platform_get_irq() failed, the negative value
> returned will not be detected here. So fix error handling in
> tegra_ehci_probe().
>
> Fixes: 79ad3b5add4a ("usb: host: Add EHCI driver for NVIDIA Tegra SoCs")
> Signed-off-by: Tang Bin <[email protected]>
> ---
> drivers/usb/host/ehci-tegra.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
> index 75a075daf..7b0efaf15 100644
> --- a/drivers/usb/host/ehci-tegra.c
> +++ b/drivers/usb/host/ehci-tegra.c
> @@ -479,9 +479,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
> u_phy->otg->host = hcd_to_bus(hcd);
>
> irq = platform_get_irq(pdev, 0);
> - if (!irq) {
> - err = -ENODEV;
> - goto cleanup_phy;
> + if (irq < 0) {
> + err = irq;
> + goto cleanup_phy;
> }
>
> otg_set_host(u_phy->otg, &hcd->self);

Acked-by: Thierry Reding <[email protected]>


Attachments:
(No filename) (1.02 kB)
signature.asc (849.00 B)
Download all attachments