0012-usb-fotg210-udc-Remove-a-useless-assignment.patch 1.4 KB

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