aboutsummaryrefslogtreecommitdiffstats
path: root/package/boot/uboot-mediatek/patches/100-00-clk-remove-log_ret-from-clk_get_rate.patch
blob: 30dcffd59e88ab07c261eccbb9cd0373251d433e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 19f2aa053d5531a9ca0ece04dca172a522d58b90 Mon Sep 17 00:00:00 2001
From: Weijie Gao <weijie.gao@mediatek.com>
Date: Fri, 29 Jul 2022 11:32:28 +0800
Subject: [PATCH 32/71] clk: remove log_ret from clk_get_rate

The return value of clk_get_rate is ulong, an unsigned type. The size of
ulong depends on the cpu architecture, i.e. 4 bytes on 32-bit CPUs and
8 bytes on 64-bit CPUs.

However log_ret only accepts and returns value in int type, a fixed 4-byte
type. This may truncate the real clock value and cause unexpected error on
64-bit platforms.

This patch removes log_ret to solve this issue.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
---
 drivers/clk/clk-uclass.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -469,7 +469,6 @@ void clk_free(struct clk *clk)
 ulong clk_get_rate(struct clk *clk)
 {
 	const struct clk_ops *ops;
-	int ret;
 
 	debug("%s(clk=%p)\n", __func__, clk);
 	if (!clk_valid(clk))
@@ -479,11 +478,7 @@ ulong clk_get_rate(struct clk *clk)
 	if (!ops->get_rate)
 		return -ENOSYS;
 
-	ret = ops->get_rate(clk);
-	if (ret)
-		return log_ret(ret);
-
-	return 0;
+	return ops->get_rate(clk);
 }
 
 struct clk *clk_get_parent(struct clk *clk)