linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/1] usb: return error code when platform_get_irq fails
       [not found] ` <1480424255-25059-1-git-send-email-bianpan2016-9Onoh4P/yGk@public.gmane.org>
@ 2016-11-30 13:41   ` Matthias Brugger
  2016-11-30 14:05     ` Mathias Nyman
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias Brugger @ 2016-11-30 13:41 UTC (permalink / raw)
  To: Pan Bian, linux-usb-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman,
	Mathias Nyman,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	moderated list:ARM/Mediatek SoC..., Chunfeng Yun
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA



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-9Onoh4P/yGk@public.gmane.org>
> ---
>  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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Next time please make sure to send the patch to all relevant lists and 
people (get_maintainer.pl).

Regards,
Matthias

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] usb: return error code when platform_get_irq fails
  2016-11-30 13:41   ` [PATCH 1/1] usb: return error code when platform_get_irq fails Matthias Brugger
@ 2016-11-30 14:05     ` Mathias Nyman
  0 siblings, 0 replies; 2+ messages in thread
From: Mathias Nyman @ 2016-11-30 14:05 UTC (permalink / raw)
  To: Matthias Brugger, Pan Bian, linux-usb, Greg Kroah-Hartman,
	Mathias Nyman, linux-arm-kernel@lists.infradead.org,
	moderated list:ARM/Mediatek SoC..., Chunfeng Yun
  Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-30 14:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1480424255-25059-1-git-send-email-bianpan2016@163.com>
     [not found] ` <1480424255-25059-1-git-send-email-bianpan2016-9Onoh4P/yGk@public.gmane.org>
2016-11-30 13:41   ` [PATCH 1/1] usb: return error code when platform_get_irq fails Matthias Brugger
2016-11-30 14:05     ` Mathias Nyman

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).