* [PATCH] clk: exynos: Fix always true test
@ 2025-07-23 16:04 Andrew Goodbody
2025-08-07 15:20 ` Andrew Goodbody
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Goodbody @ 2025-07-23 16:04 UTC (permalink / raw)
To: Lukasz Majewski, Sean Anderson, Tom Rini; +Cc: u-boot, Andrew Goodbody
In exynos7420_peric1_get_rate the variable ret is declared as an
'unsigned int' but is then used to receive the return value of
clk_get_by_index which returns an int. The value of ret is then tested
for being less than 0 which will always fail for an unsigned variable.
Fix this by declaring ret as an 'int' so that the test for the error
condition is valid.
This issue was found by Smatch.
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
---
drivers/clk/exynos/clk-exynos7420.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/exynos/clk-exynos7420.c b/drivers/clk/exynos/clk-exynos7420.c
index 3aa751bf4e4..7de4e688f03 100644
--- a/drivers/clk/exynos/clk-exynos7420.c
+++ b/drivers/clk/exynos/clk-exynos7420.c
@@ -192,7 +192,7 @@ static int exynos7420_clk_top0_probe(struct udevice *dev)
static ulong exynos7420_peric1_get_rate(struct clk *clk)
{
struct clk in_clk;
- unsigned int ret;
+ int ret;
unsigned long freq = 0;
switch (clk->id) {
---
base-commit: bd0ade7d090a334b3986936d63a34001d99722ad
change-id: 20250723-clk_exynos-b8ac6765f510
Best regards,
--
Andrew Goodbody <andrew.goodbody@linaro.org>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: exynos: Fix always true test
2025-07-23 16:04 [PATCH] clk: exynos: Fix always true test Andrew Goodbody
@ 2025-08-07 15:20 ` Andrew Goodbody
2025-09-01 9:29 ` Minkyu Kang
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Goodbody @ 2025-08-07 15:20 UTC (permalink / raw)
To: Lukasz Majewski, Sean Anderson, Tom Rini; +Cc: u-boot
On 23/07/2025 17:04, Andrew Goodbody wrote:
> In exynos7420_peric1_get_rate the variable ret is declared as an
> 'unsigned int' but is then used to receive the return value of
> clk_get_by_index which returns an int. The value of ret is then tested
> for being less than 0 which will always fail for an unsigned variable.
> Fix this by declaring ret as an 'int' so that the test for the error
> condition is valid.
>
> This issue was found by Smatch.
>
> Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
> ---
> drivers/clk/exynos/clk-exynos7420.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/exynos/clk-exynos7420.c b/drivers/clk/exynos/clk-exynos7420.c
> index 3aa751bf4e4..7de4e688f03 100644
> --- a/drivers/clk/exynos/clk-exynos7420.c
> +++ b/drivers/clk/exynos/clk-exynos7420.c
> @@ -192,7 +192,7 @@ static int exynos7420_clk_top0_probe(struct udevice *dev)
> static ulong exynos7420_peric1_get_rate(struct clk *clk)
> {
> struct clk in_clk;
> - unsigned int ret;
> + int ret;
> unsigned long freq = 0;
>
> switch (clk->id) {
>
> ---
> base-commit: bd0ade7d090a334b3986936d63a34001d99722ad
> change-id: 20250723-clk_exynos-b8ac6765f510
>
> Best regards,
Are there any comments on this patch please?
Thanks,
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: exynos: Fix always true test
2025-08-07 15:20 ` Andrew Goodbody
@ 2025-09-01 9:29 ` Minkyu Kang
0 siblings, 0 replies; 3+ messages in thread
From: Minkyu Kang @ 2025-09-01 9:29 UTC (permalink / raw)
To: Andrew Goodbody; +Cc: Lukasz Majewski, Sean Anderson, Tom Rini, u-boot
Hi,
2025년 8월 8일 (금) 00:28, Andrew Goodbody <andrew.goodbody@linaro.org>님이 작성:
> On 23/07/2025 17:04, Andrew Goodbody wrote:
> > In exynos7420_peric1_get_rate the variable ret is declared as an
> > 'unsigned int' but is then used to receive the return value of
> > clk_get_by_index which returns an int. The value of ret is then tested
> > for being less than 0 which will always fail for an unsigned variable.
> > Fix this by declaring ret as an 'int' so that the test for the error
> > condition is valid.
> >
> > This issue was found by Smatch.
> >
> > Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
> > ---
> > drivers/clk/exynos/clk-exynos7420.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/clk/exynos/clk-exynos7420.c
> b/drivers/clk/exynos/clk-exynos7420.c
> > index 3aa751bf4e4..7de4e688f03 100644
> > --- a/drivers/clk/exynos/clk-exynos7420.c
> > +++ b/drivers/clk/exynos/clk-exynos7420.c
> > @@ -192,7 +192,7 @@ static int exynos7420_clk_top0_probe(struct udevice
> *dev)
> > static ulong exynos7420_peric1_get_rate(struct clk *clk)
> > {
> > struct clk in_clk;
> > - unsigned int ret;
> > + int ret;
> > unsigned long freq = 0;
> >
> > switch (clk->id) {
> >
> > ---
> > base-commit: bd0ade7d090a334b3986936d63a34001d99722ad
> > change-id: 20250723-clk_exynos-b8ac6765f510
> >
> > Best regards,
>
> Are there any comments on this patch please?
applied to u-boot-samsung.
Thanks.
Minkyu Kang.
>
> Thanks,
> Andrew
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-01 9:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-23 16:04 [PATCH] clk: exynos: Fix always true test Andrew Goodbody
2025-08-07 15:20 ` Andrew Goodbody
2025-09-01 9:29 ` Minkyu Kang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).