097-3-usb-dwc3-Remove-impossible-check-for-of_clk_get_pare.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From 07c8b15688055d81ac8e1c8c964b9e4c302287f1 Mon Sep 17 00:00:00 2001
  2. From: Stephen Boyd <sboyd@codeaurora.org>
  3. Date: Mon, 22 Feb 2016 11:12:47 -0800
  4. Subject: [PATCH] usb: dwc3: Remove impossible check for
  5. of_clk_get_parent_count() < 0
  6. The check for < 0 is impossible now that
  7. of_clk_get_parent_count() returns an unsigned int. Simplify the
  8. code and update the types.
  9. Acked-by: Felipe Balbi <balbi@kernel.org>
  10. Cc: <linux-usb@vger.kernel.org>
  11. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
  12. (cherry picked from commit 3d755dcc20dd452b52532eca17da40ebbd12aee9)
  13. Change-Id: Iaa38e064d801fb36c855fea51c0443840368e0d3
  14. Signed-off-by: Nitheesh Sekar <nsekar@codeaurora.org>
  15. ---
  16. drivers/usb/dwc3/dwc3-of-simple.c | 9 +++++----
  17. 1 file changed, 5 insertions(+), 4 deletions(-)
  18. --- a/drivers/usb/dwc3/dwc3-of-simple.c
  19. +++ b/drivers/usb/dwc3/dwc3-of-simple.c
  20. @@ -42,6 +42,7 @@ static int dwc3_of_simple_probe(struct p
  21. struct device *dev = &pdev->dev;
  22. struct device_node *np = dev->of_node;
  23. + unsigned int count;
  24. int ret;
  25. int i;
  26. @@ -49,11 +50,11 @@ static int dwc3_of_simple_probe(struct p
  27. if (!simple)
  28. return -ENOMEM;
  29. - ret = of_clk_get_parent_count(np);
  30. - if (ret < 0)
  31. - return ret;
  32. + count = of_clk_get_parent_count(np);
  33. + if (!count)
  34. + return -ENOENT;
  35. - simple->num_clocks = ret;
  36. + simple->num_clocks = count;
  37. simple->clks = devm_kcalloc(dev, simple->num_clocks,
  38. sizeof(struct clk *), GFP_KERNEL);