UPSTREAM: usb: dwc3: Remove impossible check for of_clk_get_parent_count() < 0
authorStephen Boyd <sboyd@codeaurora.org>
Mon, 22 Feb 2016 19:12:47 +0000 (11:12 -0800)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 16 Aug 2016 12:48:19 +0000 (20:48 +0800)
The check for < 0 is impossible now that
of_clk_get_parent_count() returns an unsigned int. Simplify the
code and update the types.

Change-Id: Iadb562ddbb14a61e7e7c65ec947bab12047b100b
Acked-by: Felipe Balbi <balbi@kernel.org>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from commit 3d755dcc20dd452b52532eca17da40ebbd12aee9)

drivers/usb/dwc3/dwc3-of-simple.c

index 9c9f7415506640c82626d62167c99f3124acbe0e..974335377d9f185b282295c4aa4c688d0798f9bc 100644 (file)
@@ -42,6 +42,7 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
        struct device           *dev = &pdev->dev;
        struct device_node      *np = dev->of_node;
 
+       unsigned int            count;
        int                     ret;
        int                     i;
 
@@ -49,11 +50,11 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
        if (!simple)
                return -ENOMEM;
 
-       ret = of_clk_get_parent_count(np);
-       if (ret < 0)
-               return ret;
+       count = of_clk_get_parent_count(np);
+       if (!count)
+               return -ENOENT;
 
-       simple->num_clocks = ret;
+       simple->num_clocks = count;
 
        simple->clks = devm_kcalloc(dev, simple->num_clocks,
                        sizeof(struct clk *), GFP_KERNEL);