Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1532257 > unrolled thread
| Started by | Pan Bian <bianpan2016@163.com> |
|---|---|
| First post | 2016-11-29 14:00 +0100 |
| Last post | 2016-11-30 15:10 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH 1/1] usb: return error code when platform_get_irq fails Pan Bian <bianpan2016@163.com> - 2016-11-29 14:00 +0100
Re: [PATCH 1/1] usb: return error code when platform_get_irq fails Matthias Brugger <matthias.bgg@gmail.com> - 2016-11-30 14:50 +0100
Re: [PATCH 1/1] usb: return error code when platform_get_irq fails Mathias Nyman <mathias.nyman@linux.intel.com> - 2016-11-30 15:10 +0100
| From | Pan Bian <bianpan2016@163.com> |
|---|---|
| Date | 2016-11-29 14:00 +0100 |
| Subject | [PATCH 1/1] usb: return error code when platform_get_irq fails |
| Message-ID | <sIQaS-9a-5@gated-at.bofh.it> |
In function xhci_mtk_probe(), variable ret takes the return value. Its
value should be negative on failures. However, when the call to function
platform_get_irq() fails, it does not set the error code, and 0 will be
returned. 0 indicates no error. As a result, the callers of function
xhci_mtk_probe() will not be able to detect the error. This patch fixes
the bug by assigning the return value of platform_get_irq() to variable
ret if it fails.
Signed-off-by: Pan Bian <bianpan2016@163.com>
---
drivers/usb/host/xhci-mtk.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 79959f1..f2365a4 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -560,8 +560,10 @@ static int xhci_mtk_probe(struct platform_device *pdev)
goto disable_ldos;
irq = platform_get_irq(pdev, 0);
- if (irq < 0)
+ if (irq < 0) {
+ ret = irq;
goto disable_clk;
+ }
/* Initialize dma_mask and coherent_dma_mask to 32-bits */
ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
--
1.9.1
[toc] | [next] | [standalone]
| From | Matthias Brugger <matthias.bgg@gmail.com> |
|---|---|
| Date | 2016-11-30 14:50 +0100 |
| Message-ID | <sJdqO-6Jj-19@gated-at.bofh.it> |
| In reply to | #1532257 |
On 29/11/16 13:57, Pan Bian wrote:
> In function xhci_mtk_probe(), variable ret takes the return value. Its
> value should be negative on failures. However, when the call to function
> platform_get_irq() fails, it does not set the error code, and 0 will be
> returned. 0 indicates no error. As a result, the callers of function
> xhci_mtk_probe() will not be able to detect the error. This patch fixes
> the bug by assigning the return value of platform_get_irq() to variable
> ret if it fails.
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
> drivers/usb/host/xhci-mtk.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
> index 79959f1..f2365a4 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -560,8 +560,10 @@ static int xhci_mtk_probe(struct platform_device *pdev)
> goto disable_ldos;
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0)
> + if (irq < 0) {
> + ret = irq;
> goto disable_clk;
> + }
>
> /* Initialize dma_mask and coherent_dma_mask to 32-bits */
> ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Next time please make sure to send the patch to all relevant lists and
people (get_maintainer.pl).
Regards,
Matthias
[toc] | [prev] | [next] | [standalone]
| From | Mathias Nyman <mathias.nyman@linux.intel.com> |
|---|---|
| Date | 2016-11-30 15:10 +0100 |
| Message-ID | <sJdK9-76e-5@gated-at.bofh.it> |
| In reply to | #1533301 |
On 30.11.2016 15:41, Matthias Brugger wrote:
>
>
> On 29/11/16 13:57, Pan Bian wrote:
>> In function xhci_mtk_probe(), variable ret takes the return value. Its
>> value should be negative on failures. However, when the call to function
>> platform_get_irq() fails, it does not set the error code, and 0 will be
>> returned. 0 indicates no error. As a result, the callers of function
>> xhci_mtk_probe() will not be able to detect the error. This patch fixes
>> the bug by assigning the return value of platform_get_irq() to variable
>> ret if it fails.
>>
>> Signed-off-by: Pan Bian <bianpan2016@163.com>
>> ---
>> drivers/usb/host/xhci-mtk.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
>> index 79959f1..f2365a4 100644
>> --- a/drivers/usb/host/xhci-mtk.c
>> +++ b/drivers/usb/host/xhci-mtk.c
>> @@ -560,8 +560,10 @@ static int xhci_mtk_probe(struct platform_device *pdev)
>> goto disable_ldos;
>>
>> irq = platform_get_irq(pdev, 0);
>> - if (irq < 0)
>> + if (irq < 0) {
>> + ret = irq;
>> goto disable_clk;
>> + }
>>
>> /* Initialize dma_mask and coherent_dma_mask to 32-bits */
>> ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
>>
>
>
> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
>
Thanks, Added to queue
-Mathias
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web