提交 b2a33c17 编写于 作者: J Julia Lawall 提交者: Dave Jones

[CPUFREQ] arch/x86/kernel/cpu/cpufreq: Fix unsigned return type

In each case, the function has an unsigned return type, but returns a
negative constant to indicate an error condition.  Each function is only
called once.  For nforce2_detect_chipset, the result is only compared to 0,
and for longrun_determine_freqs, the result is stored in a variable of type
(signed) int.  Thus, for both functions, unsigned can be dropped from the
return type.

A sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@exists@
identifier f;
constant C;
@@

 unsigned f(...)
 { <+...
*  return -C;
 ...+> }
// </smpl>
Signed-off-by: NJulia Lawall <julia@diku.dk>
Signed-off-by: NDave Jones <davej@redhat.com>
上级 bec037aa
...@@ -393,7 +393,7 @@ static struct cpufreq_driver nforce2_driver = { ...@@ -393,7 +393,7 @@ static struct cpufreq_driver nforce2_driver = {
* Detects nForce2 A2 and C1 stepping * Detects nForce2 A2 and C1 stepping
* *
*/ */
static unsigned int nforce2_detect_chipset(void) static int nforce2_detect_chipset(void)
{ {
nforce2_dev = pci_get_subsys(PCI_VENDOR_ID_NVIDIA, nforce2_dev = pci_get_subsys(PCI_VENDOR_ID_NVIDIA,
PCI_DEVICE_ID_NVIDIA_NFORCE2, PCI_DEVICE_ID_NVIDIA_NFORCE2,
......
...@@ -165,7 +165,7 @@ static unsigned int longrun_get(unsigned int cpu) ...@@ -165,7 +165,7 @@ static unsigned int longrun_get(unsigned int cpu)
* TMTA rules: * TMTA rules:
* performance_pctg = (target_freq - low_freq)/(high_freq - low_freq) * performance_pctg = (target_freq - low_freq)/(high_freq - low_freq)
*/ */
static unsigned int __cpuinit longrun_determine_freqs(unsigned int *low_freq, static int __cpuinit longrun_determine_freqs(unsigned int *low_freq,
unsigned int *high_freq) unsigned int *high_freq)
{ {
u32 msr_lo, msr_hi; u32 msr_lo, msr_hi;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册