mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-25 19:07:46 +00:00
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>
This commit is contained in:
parent
cd63a1c195
commit
7faf44bf92
@ -198,6 +198,7 @@ static int wa_nep_queue(struct wahc *wa, size_t size)
|
||||
if (nw == NULL) {
|
||||
if (printk_ratelimit())
|
||||
dev_err(dev, "No memory to queue notification\n");
|
||||
result = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
INIT_WORK(&nw->work, wa_notif_dispatch);
|
||||
|
Loading…
Reference in New Issue
Block a user