]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
clk: Fix clk_get_by_* handling of index
authorSean Anderson <seanga2@gmail.com>
Wed, 24 Jun 2020 10:41:08 +0000 (06:41 -0400)
committerAndes <uboot@andestech.com>
Wed, 1 Jul 2020 07:01:21 +0000 (15:01 +0800)
clk_get_by_index_nodev only ever fetched clock 1, due to passing a boolean
predicate instead of the index. Other clk_get_by_* functions got the clock
correctly, but passed a predicate instead of the index to clk_get_by_tail.
This could lead to confusing error messages.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
CC: Lukasz Majewski <lukma@denx.de>
drivers/clk/clk-uclass.c

index 9ffc2243cb5b2dcd759bba52bca834050fb51271..70df9d410f4c2e943968737bf24cad7340da815b 100644 (file)
@@ -123,7 +123,7 @@ static int clk_get_by_indexed_prop(struct udevice *dev, const char *prop_name,
 
 
        return clk_get_by_index_tail(ret, dev_ofnode(dev), &args, "clocks",
-                                    index > 0, clk);
+                                    index, clk);
 }
 
 int clk_get_by_index(struct udevice *dev, int index, struct clk *clk)
@@ -135,7 +135,7 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk)
                                         index, &args);
 
        return clk_get_by_index_tail(ret, dev_ofnode(dev), &args, "clocks",
-                                    index > 0, clk);
+                                    index, clk);
 }
 
 int clk_get_by_index_nodev(ofnode node, int index, struct clk *clk)
@@ -144,10 +144,10 @@ int clk_get_by_index_nodev(ofnode node, int index, struct clk *clk)
        int ret;
 
        ret = ofnode_parse_phandle_with_args(node, "clocks", "#clock-cells", 0,
-                                            index > 0, &args);
+                                            index, &args);
 
        return clk_get_by_index_tail(ret, node, &args, "clocks",
-                                    index > 0, clk);
+                                    index, clk);
 }
 
 int clk_get_bulk(struct udevice *dev, struct clk_bulk *bulk)