usb: fotg210-udc: Remove a useless assignment
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 14 Nov 2022 20:38:04 +0000 (21:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Nov 2022 16:26:23 +0000 (17:26 +0100)
There is no need to use an intermediate array for these memory allocations,
so, axe it.

While at it, turn a '== NULL' into a shorter '!' when testing memory
allocation failure.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/deab9696fc4000499470e7ccbca7c36fca17bd4e.1668458274.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/fotg210/fotg210-udc.c

index 44dfe66e189cdf95b1d2eeb77b77efb9cb29f03a..b9ea6c6d931c62ccb9f67b5464c13fef94c754fd 100644 (file)
@@ -1146,7 +1146,6 @@ int fotg210_udc_probe(struct platform_device *pdev)
 {
        struct resource *res;
        struct fotg210_udc *fotg210 = NULL;
-       struct fotg210_ep *_ep[FOTG210_MAX_NUM_EP];
        struct device *dev = &pdev->dev;
        int irq;
        int ret = 0;
@@ -1205,10 +1204,9 @@ int fotg210_udc_probe(struct platform_device *pdev)
        }
 
        for (i = 0; i < FOTG210_MAX_NUM_EP; i++) {
-               _ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
-               if (_ep[i] == NULL)
+               fotg210->ep[i] = kzalloc(sizeof(struct fotg210_ep), GFP_KERNEL);
+               if (!fotg210->ep[i])
                        goto err_alloc;
-               fotg210->ep[i] = _ep[i];
        }
 
        fotg210->reg = ioremap(res->start, resource_size(res));