OSDN Git Service

usb: return error code when platform_get_irq fails
authorPan Bian <bianpan2016@163.com>
Tue, 3 Jan 2017 16:28:45 +0000 (18:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2017 10:39:13 +0000 (11:39 +0100)
commit9acba5179d6c08f5499de52cb543d2b2fbb98cc2
tree211e219f269df99a2935f01a7cb9f6feba22adf0
parentcb02cce9a7f8eea6f6c8432f296074d20829ff0f
usb: return error code when platform_get_irq fails

commit 28bedb5ae463b9f7e5195cbc93f1795e374bdef8 upstream.

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>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-mtk.c