Message ID | 20221230065427.944586-1-yangyingliang@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 1a5a23b9bdf6bde0e5185ca834ff6e806cc2aaaf |
Headers | show |
Series | usb: fotg210-udc: fix error return code in fotg210_udc_probe() | expand |
Thanks Yang! On Fri, Dec 30, 2022 at 7:57 AM Yang Yingliang <yangyingliang@huawei.com> wrote: > After commit 5f217ccd520f ("fotg210-udc: Support optional external PHY"), > the error code is re-assigned to 0 in fotg210_udc_probe(), if allocate or > map memory fails after the assignment, it can't return an error code. Set > the error code to -ENOMEM to fix this problem. > > Fixes: 5f217ccd520f ("fotg210-udc: Support optional external PHY") > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
diff --git a/drivers/usb/fotg210/fotg210-udc.c b/drivers/usb/fotg210/fotg210-udc.c index 66e1b7ee3346..87cca81bf4ac 100644 --- a/drivers/usb/fotg210/fotg210-udc.c +++ b/drivers/usb/fotg210/fotg210-udc.c @@ -1201,6 +1201,8 @@ int fotg210_udc_probe(struct platform_device *pdev) dev_info(dev, "found and initialized PHY\n"); } + ret = -ENOMEM; + for (i = 0; i < FOTG210_MAX_NUM_EP; i++) { fotg210->ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL); if (!fotg210->ep[i])
After commit 5f217ccd520f ("fotg210-udc: Support optional external PHY"), the error code is re-assigned to 0 in fotg210_udc_probe(), if allocate or map memory fails after the assignment, it can't return an error code. Set the error code to -ENOMEM to fix this problem. Fixes: 5f217ccd520f ("fotg210-udc: Support optional external PHY") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- drivers/usb/fotg210/fotg210-udc.c | 2 ++ 1 file changed, 2 insertions(+)