提交 1a5a23b9 编写于 作者: Y Yang Yingliang 提交者: Greg Kroah-Hartman

usb: fotg210-udc: fix error return code in fotg210_udc_probe()

After commit  5f217ccd ("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: 5f217ccd ("fotg210-udc: Support optional external PHY")
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20221230065427.944586-1-yangyingliang@huawei.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 2de5bba5
...@@ -1201,6 +1201,8 @@ int fotg210_udc_probe(struct platform_device *pdev) ...@@ -1201,6 +1201,8 @@ int fotg210_udc_probe(struct platform_device *pdev)
dev_info(dev, "found and initialized PHY\n"); dev_info(dev, "found and initialized PHY\n");
} }
ret = -ENOMEM;
for (i = 0; i < FOTG210_MAX_NUM_EP; i++) { for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
fotg210->ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL); fotg210->ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
if (!fotg210->ep[i]) if (!fotg210->ep[i])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册