Linux Samsung SOC development
 help / color / mirror / Atom feed
* [PATCH 1/2] cpufreq: exynos: Fix unsigned variable being checked for negative value
@ 2013-01-23  9:22 Sachin Kamat
  2013-01-23  9:22 ` [PATCH 2/2] cpufreq: exynos: Initialise return variable Sachin Kamat
  2013-01-25 18:24 ` [PATCH 1/2] cpufreq: exynos: Fix unsigned variable being checked for negative value Kukjin Kim
  0 siblings, 2 replies; 6+ messages in thread
From: Sachin Kamat @ 2013-01-23  9:22 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: kgene.kim, rjw, jhbird.choi, sachin.kamat, patches

exynos_cpufreq_scale function returns signed value which was
assigned to an unsigned variable and checked for negative value which
is always false. Hence make it signed.

Fixes the following smatch warnings:
drivers/cpufreq/exynos-cpufreq.c:83 exynos_cpufreq_scale() warn:
unsigned 'old_index' is never less than zero.
drivers/cpufreq/exynos-cpufreq.c:89 exynos_cpufreq_scale() warn:
unsigned 'index' is never less than zero.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Rafael J. Wysocki suggested these 2 patches be taken through the
Samsung tree.
---
 drivers/cpufreq/exynos-cpufreq.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index 218b3ce..88401ba 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -65,7 +65,7 @@ static int exynos_cpufreq_scale(unsigned int target_freq)
 	struct cpufreq_policy *policy = cpufreq_cpu_get(0);
 	unsigned int arm_volt, safe_arm_volt = 0;
 	unsigned int mpll_freq_khz = exynos_info->mpll_freq_khz;
-	unsigned int index, old_index;
+	int index, old_index;
 	int ret = 0;
 
 	freqs.old = policy->cur;
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] cpufreq: exynos: Initialise return variable
  2013-01-23  9:22 [PATCH 1/2] cpufreq: exynos: Fix unsigned variable being checked for negative value Sachin Kamat
@ 2013-01-23  9:22 ` Sachin Kamat
  2013-01-25 18:26   ` Kukjin Kim
  2013-01-25 18:24 ` [PATCH 1/2] cpufreq: exynos: Fix unsigned variable being checked for negative value Kukjin Kim
  1 sibling, 1 reply; 6+ messages in thread
From: Sachin Kamat @ 2013-01-23  9:22 UTC (permalink / raw)
  To: linux-samsung-soc; +Cc: kgene.kim, rjw, jhbird.choi, sachin.kamat, patches

'ret' is undefined when the function returns from the first
'if' condition. Without this patch we get the following warning:

drivers/cpufreq/exynos-cpufreq.c: In function ‘exynos_target’:
drivers/cpufreq/exynos-cpufreq.c:182:2: warning:
‘ret’ may be used uninitialized in this function [-Wuninitialized]

Suggested-by: Jonghwan Choi <jhbird.choi@samsung.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/cpufreq/exynos-cpufreq.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
index 88401ba..4268e46 100644
--- a/drivers/cpufreq/exynos-cpufreq.c
+++ b/drivers/cpufreq/exynos-cpufreq.c
@@ -159,7 +159,7 @@ static int exynos_target(struct cpufreq_policy *policy,
 {
 	struct cpufreq_frequency_table *freq_table = exynos_info->freq_table;
 	unsigned int index;
-	int ret;
+	int ret = 0;
 
 	mutex_lock(&cpufreq_lock);
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH 1/2] cpufreq: exynos: Fix unsigned variable being checked for negative value
  2013-01-23  9:22 [PATCH 1/2] cpufreq: exynos: Fix unsigned variable being checked for negative value Sachin Kamat
  2013-01-23  9:22 ` [PATCH 2/2] cpufreq: exynos: Initialise return variable Sachin Kamat
@ 2013-01-25 18:24 ` Kukjin Kim
  1 sibling, 0 replies; 6+ messages in thread
From: Kukjin Kim @ 2013-01-25 18:24 UTC (permalink / raw)
  To: 'Sachin Kamat', linux-samsung-soc; +Cc: rjw, jhbird.choi, patches

Sachin Kamat wrote:
> 
> exynos_cpufreq_scale function returns signed value which was
> assigned to an unsigned variable and checked for negative value which
> is always false. Hence make it signed.
> 
> Fixes the following smatch warnings:
> drivers/cpufreq/exynos-cpufreq.c:83 exynos_cpufreq_scale() warn:
> unsigned 'old_index' is never less than zero.
> drivers/cpufreq/exynos-cpufreq.c:89 exynos_cpufreq_scale() warn:
> unsigned 'index' is never less than zero.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> Rafael J. Wysocki suggested these 2 patches be taken through the
> Samsung tree.
> ---
>  drivers/cpufreq/exynos-cpufreq.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
Looks OK to me, applied.

Thanks.

- Kukjin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 2/2] cpufreq: exynos: Initialise return variable
  2013-01-23  9:22 ` [PATCH 2/2] cpufreq: exynos: Initialise return variable Sachin Kamat
@ 2013-01-25 18:26   ` Kukjin Kim
  2013-01-25 19:58     ` Rafael J. Wysocki
  0 siblings, 1 reply; 6+ messages in thread
From: Kukjin Kim @ 2013-01-25 18:26 UTC (permalink / raw)
  To: 'Sachin Kamat', linux-samsung-soc; +Cc: rjw, jhbird.choi, patches

Sachin Kamat wrote:
> 
> 'ret' is undefined when the function returns from the first
> 'if' condition. Without this patch we get the following warning:
> 
> drivers/cpufreq/exynos-cpufreq.c: In function ‘exynos_target’:
> drivers/cpufreq/exynos-cpufreq.c:182:2: warning:
> ‘ret’ may be used uninitialized in this function [-Wuninitialized]
> 
> Suggested-by: Jonghwan Choi <jhbird.choi@samsung.com>

I modified above to 'Reported-by' because checkpatch complains like following...

WARNING: Non-standard signature: Suggested-by:
#10:
Suggested-by: Jonghwan Choi <jhbird.choi@samsung.com>

> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/cpufreq/exynos-cpufreq.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
Applied, thanks.

- Kukjin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] cpufreq: exynos: Initialise return variable
  2013-01-25 18:26   ` Kukjin Kim
@ 2013-01-25 19:58     ` Rafael J. Wysocki
  2013-02-01  1:11       ` Kukjin Kim
  0 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2013-01-25 19:58 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: 'Sachin Kamat', linux-samsung-soc, jhbird.choi, patches

On Friday, January 25, 2013 10:26:41 AM Kukjin Kim wrote:
> Sachin Kamat wrote:
> > 
> > 'ret' is undefined when the function returns from the first
> > 'if' condition. Without this patch we get the following warning:
> > 
> > drivers/cpufreq/exynos-cpufreq.c: In function ‘exynos_target’:
> > drivers/cpufreq/exynos-cpufreq.c:182:2: warning:
> > ‘ret’ may be used uninitialized in this function [-Wuninitialized]
> > 
> > Suggested-by: Jonghwan Choi <jhbird.choi@samsung.com>
> 
> I modified above to 'Reported-by' because checkpatch complains like following...
> 
> WARNING: Non-standard signature: Suggested-by:
> #10:
> Suggested-by: Jonghwan Choi <jhbird.choi@samsung.com>

This tag has been used already, though, and I think it makes sense (more than
Reported-by in this case).  I think it may be regarded as standard regardless
of what checkpatch has to say about that. :-)

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 2/2] cpufreq: exynos: Initialise return variable
  2013-01-25 19:58     ` Rafael J. Wysocki
@ 2013-02-01  1:11       ` Kukjin Kim
  0 siblings, 0 replies; 6+ messages in thread
From: Kukjin Kim @ 2013-02-01  1:11 UTC (permalink / raw)
  To: 'Rafael J. Wysocki'
  Cc: 'Sachin Kamat', linux-samsung-soc, jhbird.choi, patches

Rafael J. Wysocki wrote:
> 
> On Friday, January 25, 2013 10:26:41 AM Kukjin Kim wrote:
> > Sachin Kamat wrote:
> > >
> > > 'ret' is undefined when the function returns from the first
> > > 'if' condition. Without this patch we get the following warning:
> > >
> > > drivers/cpufreq/exynos-cpufreq.c: In function ‘exynos_target’:
> > > drivers/cpufreq/exynos-cpufreq.c:182:2: warning:
> > > ‘ret’ may be used uninitialized in this function [-Wuninitialized]
> > >
> > > Suggested-by: Jonghwan Choi <jhbird.choi@samsung.com>
> >
> > I modified above to 'Reported-by' because checkpatch complains like
> following...
> >
> > WARNING: Non-standard signature: Suggested-by:
> > #10:
> > Suggested-by: Jonghwan Choi <jhbird.choi@samsung.com>
> 
> This tag has been used already, though, and I think it makes sense (more
> than  

Yes, agreed.

> Reported-by in this case).  I think it may be regarded as standard regardless
> of what checkpatch has to say about that. :-)
> 
I see. Let me keep the 'Reported-by' here.
Thanks for your opinion.

- Kukjin

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-02-01  1:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-23  9:22 [PATCH 1/2] cpufreq: exynos: Fix unsigned variable being checked for negative value Sachin Kamat
2013-01-23  9:22 ` [PATCH 2/2] cpufreq: exynos: Initialise return variable Sachin Kamat
2013-01-25 18:26   ` Kukjin Kim
2013-01-25 19:58     ` Rafael J. Wysocki
2013-02-01  1:11       ` Kukjin Kim
2013-01-25 18:24 ` [PATCH 1/2] cpufreq: exynos: Fix unsigned variable being checked for negative value Kukjin Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox