1 From 7889a2f0256c55e0184dffd0001d0782f9e4cb83 Mon Sep 17 00:00:00 2001
2 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
3 Date: Mon, 14 Nov 2022 21:38:04 +0100
4 Subject: [PATCH 12/29] usb: fotg210-udc: Remove a useless assignment
6 There is no need to use an intermediate array for these memory allocations,
9 While at it, turn a '== NULL' into a shorter '!' when testing memory
12 Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
13 Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
14 Link: https://lore.kernel.org/r/deab9696fc4000499470e7ccbca7c36fca17bd4e.1668458274.git.christophe.jaillet@wanadoo.fr
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17 --- a/drivers/usb/fotg210/fotg210-udc.c
18 +++ b/drivers/usb/fotg210/fotg210-udc.c
19 @@ -1159,7 +1159,6 @@ int fotg210_udc_probe(struct platform_de
22 struct fotg210_udc *fotg210 = NULL;
23 - struct fotg210_ep *_ep[FOTG210_MAX_NUM_EP];
24 struct device *dev = &pdev->dev;
27 @@ -1218,10 +1217,9 @@ int fotg210_udc_probe(struct platform_de
30 for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
31 - _ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
33 + fotg210->ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
34 + if (!fotg210->ep[i])
36 - fotg210->ep[i] = _ep[i];
39 fotg210->reg = ioremap(res->start, resource_size(res));