gemini: Add kernel v6.1 patches
[openwrt/staging/stintel.git] / target / linux / gemini / patches-6.1 / 0015-usb-fotg210-udc-fix-error-return-code-in-fotg210_udc.patch
1 From eaaa85d907fe27852dd960b2bc5d7bcf11bc3ebd Mon Sep 17 00:00:00 2001
2 From: Yang Yingliang <yangyingliang@huawei.com>
3 Date: Fri, 30 Dec 2022 14:54:27 +0800
4 Subject: [PATCH 15/29] usb: fotg210-udc: fix error return code in
5 fotg210_udc_probe()
6
7 After commit 5f217ccd520f ("fotg210-udc: Support optional external PHY"),
8 the error code is re-assigned to 0 in fotg210_udc_probe(), if allocate or
9 map memory fails after the assignment, it can't return an error code. Set
10 the error code to -ENOMEM to fix this problem.
11
12 Fixes: 5f217ccd520f ("fotg210-udc: Support optional external PHY")
13 Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
14 Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
15 Link: https://lore.kernel.org/r/20221230065427.944586-1-yangyingliang@huawei.com
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17 ---
18 --- a/drivers/usb/fotg210/fotg210-udc.c
19 +++ b/drivers/usb/fotg210/fotg210-udc.c
20 @@ -1214,6 +1214,8 @@ int fotg210_udc_probe(struct platform_de
21 dev_info(dev, "found and initialized PHY\n");
22 }
23
24 + ret = -ENOMEM;
25 +
26 for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
27 fotg210->ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
28 if (!fotg210->ep[i])