Patchwork : Minor quibble in macintosh/windfarm_pm81.c

login
register
mail settings
Submitter d binderman
Date March 19, 2010, 9:01 a.m.
Message ID <BLU108-W19BF72C9933FC2647F761B9C2A0@phx.gbl>
Download mbox | patch
Permalink /patch/48122/
State Accepted
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

d binderman - March 19, 2010, 9:01 a.m.
Hello there,

I just ran the sourceforge tool cppcheck over the source code of the
new Linux kernel 2.6.34-rc1

It said

[./macintosh/windfarm_pm81.c:760]: (style) Redundant condition. It is safe to deallocate a NULL poin
ter
[./macintosh/windfarm_pm81.c:762]: (style) Redundant condition. It is safe to deallocate a NULL poin
ter

The source code is

        /* Destroy control loops state structures */
        if (wf_smu_sys_fans)
                kfree(wf_smu_sys_fans);
        if (wf_smu_cpu_fans)
                kfree(wf_smu_cpu_fans);

Proposed patch file attached.

Regards

David Binderman

Patch


Signed-off-by: David Binderman <dcb314@hotmail.com>

--- macintosh/windfarm_pm81.c.sav	2010-03-19 08:57:22.000000000 +0000
+++ macintosh/windfarm_pm81.c	2010-03-19 08:57:34.000000000 +0000
@@ -757,10 +757,8 @@  static int __devexit wf_smu_remove(struc
 		wf_put_control(cpufreq_clamp);
 
 	/* Destroy control loops state structures */
-	if (wf_smu_sys_fans)
-		kfree(wf_smu_sys_fans);
-	if (wf_smu_cpu_fans)
-		kfree(wf_smu_cpu_fans);
+	kfree(wf_smu_sys_fans);
+	kfree(wf_smu_cpu_fans);
 
 	return 0;
 }