]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
drivers: clk: Adjust temp var data type to properly match that of struct clk_ops
authorNathan Barrett-Morrison <nathan.morrison@timesys.com>
Mon, 15 May 2023 19:49:58 +0000 (15:49 -0400)
committerSean Anderson <seanga2@gmail.com>
Wed, 1 Nov 2023 19:13:15 +0000 (15:13 -0400)
In commit 5c5992cb90cf ("clk: Add debugging for return values"), a
temporary storage variable was added around the ops->get_rate() call
inside clk_get_rate(), so that the result could be passed through
log_ret.

This temporary variable was declared as an int, yet when we look in
struct clk_ops, we can see this needs to be a ulong:
ulong (*get_rate)(struct clk *clk);

This was resulting in a signed to unsigned casting error on our
builds, where a clock value of 0xABCDABCD was being incorrectly cast
to 0xFFFFFFFFABCDABCD.

Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20230515195005.1961495-1-nathan.morrison@timesys.com
drivers/clk/clk-uclass.c

index f186fcbcdb868a5c9d6c17d64924649a1efad01a..364ee92e7f1afdf0c3b6fca91a3c55aa26823a3e 100644 (file)
@@ -477,7 +477,7 @@ void clk_free(struct clk *clk)
 ulong clk_get_rate(struct clk *clk)
 {
        const struct clk_ops *ops;
-       int ret;
+       ulong ret;
 
        debug("%s(clk=%p)\n", __func__, clk);
        if (!clk_valid(clk))