Skip to content

Commit 1a5a23b

Browse files
Yang Yinglianggregkh
authored andcommitted
usb: fotg210-udc: fix error return code in fotg210_udc_probe()
After commit 5f217cc ("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: 5f217cc ("fotg210-udc: Support optional external PHY") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20221230065427.944586-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2de5bba commit 1a5a23b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/usb/fotg210/fotg210-udc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,8 @@ int fotg210_udc_probe(struct platform_device *pdev)
12011201
dev_info(dev, "found and initialized PHY\n");
12021202
}
12031203

1204+
ret = -ENOMEM;
1205+
12041206
for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
12051207
fotg210->ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
12061208
if (!fotg210->ep[i])

0 commit comments

Comments
 (0)