linux-2.6.36-rc3 bug report
Hello there, I just tried out cppcheck-1.44 on the linux-2.6.36-rc3 source code. It said Checking arch/powerpc/kernel/ppc970-pmu.c... [arch/powerpc/kernel/ppc970-pmu.c:171]: (style) Redundant assignment of mask in switch The source code is case PM_VPU: mask = 0x4c; /* byte 0 bits 2,3,6 */ case PM_LSU0: /* byte 2 bits 0,2,3,4,6; all of byte 1 */ mask = 0x085dff00; case PM_LSU1L: mask = 0x50 24; /* byte 3 bits 4,6 */ break; It looks to me like a missing break on the first and second cases. Suggest code rework. Regards David Binderman ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH]: Minor quibble in macintosh/windfarm_pm81.c
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 _ Send us your Hotmail stories and be featured in our newsletter http://clk.atdmt.com/UKM/go/195013117/direct/01/ Signed-off-by: David Binderman dcb...@hotmail.com --- macintosh/windfarm_pm81.c.sav 2010-03-19 08:57:22.0 + +++ macintosh/windfarm_pm81.c 2010-03-19 08:57:34.0 + @@ -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; } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH]: core/gpio-pmf.c: 3 * redundant code
_ Send us your Hotmail stories and be featured in our newsletter http://clk.atdmt.com/UKM/go/195013117/direct/01/ Signed-off-by: David Binderman dcb...@hotmail.com --- aoa/core/gpio-pmf.c.sav 2010-03-19 10:07:30.0 + +++ aoa/core/gpio-pmf.c 2010-03-19 10:07:40.0 + @@ -115,12 +115,9 @@ static void pmf_gpio_exit(struct gpio_ru mutex_destroy(rt-line_in_notify.mutex); mutex_destroy(rt-line_out_notify.mutex); - if (rt-headphone_notify.gpio_private) - kfree(rt-headphone_notify.gpio_private); - if (rt-line_in_notify.gpio_private) - kfree(rt-line_in_notify.gpio_private); - if (rt-line_out_notify.gpio_private) - kfree(rt-line_out_notify.gpio_private); + kfree(rt-headphone_notify.gpio_private); + kfree(rt-line_in_notify.gpio_private); + kfree(rt-line_out_notify.gpio_private); } static void pmf_handle_notify_irq(void *data) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
powermac/low_i2c.c: three minor problems
Hello there, I just ran the sourceforge tool cppcheck over the source code of the new Linux kernel 2.6.33-rc6 It said [./arch/powerpc/platforms/powermac/low_i2c.c:594]: (style) The scope of the variable chans can be reduced [./arch/powerpc/platforms/powermac/low_i2c.c:594]: (style) The scope of the variable i can be reduced [./arch/powerpc/platforms/powermac/low_i2c.c:1260]: (style) Redundant condition. It is safe to deallocate a NULL pointer Please find attached a patch to fix these minor problems. The patched version compiles, but I have not been able to test it at run time. Regards David Binderman _ Do you have a story that started on Hotmail? Tell us now http://clk.atdmt.com/UKM/go/195013117/direct/01/--- arch/powerpc/platforms/powermac/low_i2c.c.sav 2010-02-06 11:52:21.0 + +++ arch/powerpc/platforms/powermac/low_i2c.c 2010-02-06 11:53:07.0 + @@ -591,7 +591,7 @@ static void __init kw_i2c_probe(void) /* Probe keywest-i2c busses */ for_each_compatible_node(np, i2c,keywest-i2c) { struct pmac_i2c_host_kw *host; - int multibus, chans, i; + int multibus; /* Found one, init a host structure */ host = kw_i2c_host_init(np); @@ -613,6 +613,8 @@ static void __init kw_i2c_probe(void) * parent type */ if (multibus) { + int chans, i; + parent = of_get_parent(np); if (parent == NULL) continue; @@ -1257,8 +1259,7 @@ static void pmac_i2c_do_end(struct pmf_f if (inst == NULL) return; pmac_i2c_close(inst-bus); - if (inst) - kfree(inst); + kfree(inst); } static int pmac_i2c_do_read(PMF_STD_ARGS, u32 len) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev