aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPan Bian <bianpan2016@163.com>2016-11-29 07:56:10 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-11-29 11:36:43 -0500
commit7faf44bf925531478f5862002d6291893a3b9ba3 (patch)
treead3fbeb2d810c45669076905b1cd4895739ce883
parentcd63a1c1952e169b788ee3ee2a064546ca325ea0 (diff)
usb: fix improper return value when kzalloc fails
The comment says function wa_nep_queue() should return 0 if ok, and <0 errno code on error. However, its implementation always returns 0, even if the call to kzalloc() fails. As a result, the return value may be inconsistent with the execution status, which may mislead the callers. This patch fixes the bug, returning -ENOMEM when the call to kzalloc() fails. Signed-off-by: Pan Bian <bianpan2016@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/wusbcore/wa-nep.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/wusbcore/wa-nep.c b/drivers/usb/wusbcore/wa-nep.c
index ed4622279c63..e3819fc182b0 100644
--- a/drivers/usb/wusbcore/wa-nep.c
+++ b/drivers/usb/wusbcore/wa-nep.c
@@ -198,6 +198,7 @@ static int wa_nep_queue(struct wahc *wa, size_t size)
198 if (nw == NULL) { 198 if (nw == NULL) {
199 if (printk_ratelimit()) 199 if (printk_ratelimit())
200 dev_err(dev, "No memory to queue notification\n"); 200 dev_err(dev, "No memory to queue notification\n");
201 result = -ENOMEM;
201 goto out; 202 goto out;
202 } 203 }
203 INIT_WORK(&nw->work, wa_notif_dispatch); 204 INIT_WORK(&nw->work, wa_notif_dispatch);