gemini: Add kernel v6.1 patches
[openwrt/openwrt.git] / target / linux / gemini / patches-6.1 / 0012-usb-fotg210-udc-Remove-a-useless-assignment.patch
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
5
6 There is no need to use an intermediate array for these memory allocations,
7 so, axe it.
8
9 While at it, turn a '== NULL' into a shorter '!' when testing memory
10 allocation failure.
11
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>
16 ---
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
20 {
21 struct resource *res;
22 struct fotg210_udc *fotg210 = NULL;
23 - struct fotg210_ep *_ep[FOTG210_MAX_NUM_EP];
24 struct device *dev = &pdev->dev;
25 int irq;
26 int ret = 0;
27 @@ -1218,10 +1217,9 @@ int fotg210_udc_probe(struct platform_de
28 }
29
30 for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
31 - _ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
32 - if (_ep[i] == NULL)
33 + fotg210->ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
34 + if (!fotg210->ep[i])
35 goto err_alloc;
36 - fotg210->ep[i] = _ep[i];
37 }
38
39 fotg210->reg = ioremap(res->start, resource_size(res));