linux-4.8-rc3/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c:3533: pointless test ?

2016-08-22 Thread David Binderman
ExtensionVer >= 1) { Suggest remove second test. Regards David Binderman

linux-4.8-rc3/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c:3533: pointless test ?

2016-08-22 Thread David Binderman
ExtensionVer >= 1) { Suggest remove second test. Regards David Binderman

linux-4.8-rc1/drivers/scsi/sd.c:317: pointless test ?

2016-08-08 Thread David Binderman
TECTION) Regards David Binderman

linux-4.8-rc1/drivers/scsi/sd.c:317: pointless test ?

2016-08-08 Thread David Binderman
TECTION) Regards David Binderman

linux-4.8-rc1/drivers/dma/txx9dmac.c: 2 * pointless expression ?

2016-08-08 Thread David Binderman
lt;= 0x7f) 2. inux-4.8-rc1/drivers/dma/txx9dmac.c:746]: (style) Expression '(X & 0xff) <= 0xff' is always true. Duplicate, a few lines earlier. Regards David Binderman

linux-4.8-rc1/drivers/dma/txx9dmac.c: 2 * pointless expression ?

2016-08-08 Thread David Binderman
lt;= 0x7f) 2. inux-4.8-rc1/drivers/dma/txx9dmac.c:746]: (style) Expression '(X & 0xff) <= 0xff' is always true. Duplicate, a few lines earlier. Regards David Binderman

include/drm/i915_drm.h:96: possible bad bitmask ?

2016-08-08 Thread David Binderman
TEL_BSM_MASK (0xUL<< 20) might be better. Regards David Binderman

include/drm/i915_drm.h:96: possible bad bitmask ?

2016-08-08 Thread David Binderman
TEL_BSM_MASK (0xUL<< 20) might be better. Regards David Binderman

drivers/staging/ks7010/ks_wlan_net.c:1287: suspicious if ?

2016-08-01 Thread David Binderman
else return -EINVAL; } else if (enabled) { /* 2 */ I am not sure of a suitable fix for this. Regards David Binderman

drivers/staging/ks7010/ks_wlan_net.c:1287: suspicious if ?

2016-08-01 Thread David Binderman
else return -EINVAL; } else if (enabled) { /* 2 */ I am not sure of a suitable fix for this. Regards David Binderman

include/linux/cec-funcs.h:1280: suspicious expression ?

2016-08-01 Thread David Binderman
Hello there, include/linux/cec-funcs.h:1280:50: warning: logical ‘and’ applied to non-boolean constant [-Wlogical-op] Source code is msg->msg[4] = ui_cmd->channel_identifier.major && 0xff; Maybe better code msg->msg[4] = ui_cmd->channel_identifier.major &am

include/linux/cec-funcs.h:1280: suspicious expression ?

2016-08-01 Thread David Binderman
Hello there, include/linux/cec-funcs.h:1280:50: warning: logical ‘and’ applied to non-boolean constant [-Wlogical-op] Source code is msg->msg[4] = ui_cmd->channel_identifier.major && 0xff; Maybe better code msg->msg[4] = ui_cmd->channel_identifier.major &am

xfs_icache.c:1298]: (style) Redundant condition

2016-07-25 Thread David Binderman
de ASSERT(!eofb || (eofb->eof_scan_owner != 0)); Regards David Binderman

xfs_icache.c:1298]: (style) Redundant condition

2016-07-25 Thread David Binderman
de ASSERT(!eofb || (eofb->eof_scan_owner != 0)); Regards David Binderman

drivers/usb/usbip/vudc_rx.c:145: possible bad bitmask ?

2016-07-18 Thread David Binderman
Hello there, drivers/usb/usbip/vudc_rx.c:145:27: warning: result of ‘11 << 30’ requires 35 bits to represent, but ‘int’ only has 32 bits [-Wshift-overflow=] Source code is urb_p->urb->pipe &= ~(11 << 30); Maybe better code urb_p->urb->pipe &= ~(11UL << 30); Regards David Binderman

drivers/usb/usbip/vudc_rx.c:145: possible bad bitmask ?

2016-07-18 Thread David Binderman
Hello there, drivers/usb/usbip/vudc_rx.c:145:27: warning: result of ‘11 << 30’ requires 35 bits to represent, but ‘int’ only has 32 bits [-Wshift-overflow=] Source code is urb_p->urb->pipe &= ~(11 << 30); Maybe better code urb_p->urb->pipe &= ~(11UL << 30); Regards David Binderman

Re: arch/powerpc/xmon/dis-asm.h: 2 * wrong specifiers ?

2016-06-28 Thread David Binderman
int? I don't know the code, but given that insn is unsigned long and so can go past 32 bits, using a cast to unsigned int might throw away the possibly important upper bits. Regards David Binderman

Re: arch/powerpc/xmon/dis-asm.h: 2 * wrong specifiers ?

2016-06-28 Thread David Binderman
but given that insn is unsigned long and so can go past 32 bits, using a cast to unsigned int might throw away the possibly important upper bits. Regards David Binderman

drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c:1812: possible pointless variable ?

2016-06-27 Thread David Binderman
the variable in some way, or delete it. Regards David Binderman

drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c:1812: possible pointless variable ?

2016-06-27 Thread David Binderman
the variable in some way, or delete it. Regards David Binderman

arch/powerpc/xmon/dis-asm.h: 2 * wrong specifiers ?

2016-06-27 Thread David Binderman
is 'unsigned long'. Source code is static inline int print_insn_powerpc(unsigned long insn, unsigned long memaddr) { printf("%.8x", insn); return 0; } static inline int print_insn_spu(unsigned long insn, unsigned long memaddr) { printf("%.8x", insn); return

arch/powerpc/xmon/dis-asm.h: 2 * wrong specifiers ?

2016-06-27 Thread David Binderman
is 'unsigned long'. Source code is static inline int print_insn_powerpc(unsigned long insn, unsigned long memaddr) { printf("%.8x", insn); return 0; } static inline int print_insn_spu(unsigned long insn, unsigned long memaddr) { printf("%.8x", insn); return

arch/powerpc/platforms/512x/clock-commonclk.c:824: wrong % specifier ?

2016-06-27 Thread David Binderman
Hello there, linux-4.7-rc5/arch/powerpc/platforms/512x/clock-commonclk.c:824]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'size_t {aka unsigned long}'. Source code is snprintf(name, sizeof(name), "psc%d", mclk_idx); Regards David Binderman

arch/powerpc/platforms/512x/clock-commonclk.c:824: wrong % specifier ?

2016-06-27 Thread David Binderman
Hello there, linux-4.7-rc5/arch/powerpc/platforms/512x/clock-commonclk.c:824]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'size_t {aka unsigned long}'. Source code is snprintf(name, sizeof(name), "psc%d", mclk_idx); Regards David Binderman

Re: linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?

2016-06-15 Thread David Binderman
m_crtcs) return 0; crtc = priv->crtcs[pipe]; Feel free to mess this tentative patch about in any way you see fit. Regards David Binderman On Mon, Jun 13, 2016 at 4:27 PM, Rob Clark <robdcl...@gmail.com> wrote: > yup, looks like we can drop the two pipe<0 chec

Re: linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?

2016-06-15 Thread David Binderman
m_crtcs) return 0; crtc = priv->crtcs[pipe]; Feel free to mess this tentative patch about in any way you see fit. Regards David Binderman On Mon, Jun 13, 2016 at 4:27 PM, Rob Clark wrote: > yup, looks like we can drop the two pipe<0 checks. Care to send a patch? > >

linux-4.7-rc3/drivers/net/wireless/ath/ath9k/htc_drv_main.c: 2 * strange tests ?

2016-06-13 Thread David Binderman
_drv_main.c:228]: (style) Variable 'ret' is assigned a value that is never used. This might be a case where a function return value is not checked. Regards David Binderman

linux-4.7-rc3/drivers/net/wireless/ath/ath9k/htc_drv_main.c: 2 * strange tests ?

2016-06-13 Thread David Binderman
_drv_main.c:228]: (style) Variable 'ret' is assigned a value that is never used. This might be a case where a function return value is not checked. Regards David Binderman

linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?

2016-06-13 Thread David Binderman
Checking if unsigned variable 'pipe' is less than zero. Duplicate a few lines further down. Regards David Binderman

linux-4.7-rc3/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c: 2 * pointless tests ?

2016-06-13 Thread David Binderman
Checking if unsigned variable 'pipe' is less than zero. Duplicate a few lines further down. Regards David Binderman

linux-4.7-rc3/drivers/dma/cppi41.c:509: pointless test ?

2016-06-13 Thread David Binderman
Hello there, linux-4.7-rc3/drivers/dma/cppi41.c:509]: (style) Condition 'num>0' is always false Source code is BUG_ON(num > 0); Local variable num doesn't get used anywhere. Suggest remove. Regards David Binderman

linux-4.7-rc3/drivers/dma/cppi41.c:509: pointless test ?

2016-06-13 Thread David Binderman
Hello there, linux-4.7-rc3/drivers/dma/cppi41.c:509]: (style) Condition 'num>0' is always false Source code is BUG_ON(num > 0); Local variable num doesn't get used anywhere. Suggest remove. Regards David Binderman

linux-4.7-rc3/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4836: wierd condition ?

2016-06-13 Thread David Binderman
never used. [drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4657]: (style) Variable 'tmp' is assigned a value that is never used. Regards David Binderman

linux-4.7-rc3/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4836: wierd condition ?

2016-06-13 Thread David Binderman
never used. [drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4657]: (style) Variable 'tmp' is assigned a value that is never used. Regards David Binderman

linux-4.7-rc2/drivers/video/fbdev/sis/init.c: 2* bad if tests ?

2016-06-07 Thread David Binderman
' is assigned a value that is never used. [drivers/video/fbdev/sis/init.c:3616]: (style) Variable 'VBS' is assigned a value that is never used. [drivers/video/fbdev/sis/init.c:3597]: (style) Variable 'A' is assigned a value that is never used. Suggest either use these variables in some way, or delete them. Regards David Binderman

linux-4.7-rc2/drivers/video/fbdev/sis/init.c: 2* bad if tests ?

2016-06-07 Thread David Binderman
' is assigned a value that is never used. [drivers/video/fbdev/sis/init.c:3616]: (style) Variable 'VBS' is assigned a value that is never used. [drivers/video/fbdev/sis/init.c:3597]: (style) Variable 'A' is assigned a value that is never used. Suggest either use these variables in some way, or delete them. Regards David Binderman

linux-4.7-rc2/drivers/video/fbdev/intelfb/intelfbdrv.c:1041]: (style) Redundant condition

2016-06-07 Thread David Binderman
Hello there, linux-4.7-rc2/drivers/video/fbdev/intelfb/intelfbdrv.c:1041]: (style) Redundant condition: If 'msrc > 1', the comparison 'msrc' is always true. Source code is if (msrc && msrc > 1) { Maybe better code if (msrc > 1) { Regards David Binderman

linux-4.7-rc2/drivers/video/fbdev/intelfb/intelfbdrv.c:1041]: (style) Redundant condition

2016-06-07 Thread David Binderman
Hello there, linux-4.7-rc2/drivers/video/fbdev/intelfb/intelfbdrv.c:1041]: (style) Redundant condition: If 'msrc > 1', the comparison 'msrc' is always true. Source code is if (msrc && msrc > 1) { Maybe better code if (msrc > 1) { Regards David Binderman

linux-4.7-rc2/drivers/rtc/rtc-ds1685.c: 2 * bad if test ?

2016-06-07 Thread David Binderman
c-ds1685.c:812]: (style) Variable 'ctrlc' is assigned a value that is never used. Regards David Binderman

linux-4.7-rc2/drivers/rtc/rtc-ds1685.c: 2 * bad if test ?

2016-06-07 Thread David Binderman
c-ds1685.c:812]: (style) Variable 'ctrlc' is assigned a value that is never used. Regards David Binderman

linux-4.7-rc2/drivers/net/wireless/ath/ath6kl/wmi.c:2547]: (style) Redundant condition

2016-06-07 Thread David Binderman
net/wireless/ath/ath6kl/wmi.c:3521]: (style) Variable 'ret' is assigned a value that is never used. Regards David Binderman

linux-4.7-rc2/drivers/net/wireless/ath/ath6kl/wmi.c:2547]: (style) Redundant condition

2016-06-07 Thread David Binderman
net/wireless/ath/ath6kl/wmi.c:3521]: (style) Variable 'ret' is assigned a value that is never used. Regards David Binderman

linux-4.7-rc2/drivers/net/fjes/fjes_main.c:1346]: (style) Redundant condition

2016-06-07 Thread David Binderman
le: [drivers/net/fjes/fjes_main.c:1321]: (style) Variable 'max_epid' is assigned a value that is never used. [drivers/net/fjes/fjes_main.c:1320]: (style) Variable 'my_epid' is assigned a value that is never used. These two might be candidates for deletion. Regards David Binderman

linux-4.7-rc2/drivers/net/fjes/fjes_main.c:1346]: (style) Redundant condition

2016-06-07 Thread David Binderman
le: [drivers/net/fjes/fjes_main.c:1321]: (style) Variable 'max_epid' is assigned a value that is never used. [drivers/net/fjes/fjes_main.c:1320]: (style) Variable 'my_epid' is assigned a value that is never used. These two might be candidates for deletion. Regards David Binderman

linux-4.7-rc2/drivers/net/ethernet/freescale/fman/fman.c:2329]: (style) Redundant condition

2016-06-07 Thread David Binderman
_id] && (mfl <= fman->state->port_mfl[mac_id]))) { Suggest new code if ((!fman->state->port_mfl[mac_id]) || (mfl <= fman->state->port_mfl[mac_id])) { Regards David Binderman

linux-4.7-rc2/drivers/net/ethernet/freescale/fman/fman.c:2329]: (style) Redundant condition

2016-06-07 Thread David Binderman
_id] && (mfl <= fman->state->port_mfl[mac_id]))) { Suggest new code if ((!fman->state->port_mfl[mac_id]) || (mfl <= fman->state->port_mfl[mac_id])) { Regards David Binderman

drivers/net/ethernet/qlogic/qed/qed_dcbx.c:210: pointless test ?

2016-05-23 Thread David Binderman
Hello there, drivers/net/ethernet/qlogic/qed/qed_dcbx.c:210:16: warning: comparison is always false due to limited range of data type [-Wtype-limits] Source code is if (priority < 0) { but u8 tc, priority, priority_map; Regards David Binderman

drivers/net/ethernet/qlogic/qed/qed_dcbx.c:210: pointless test ?

2016-05-23 Thread David Binderman
Hello there, drivers/net/ethernet/qlogic/qed/qed_dcbx.c:210:16: warning: comparison is always false due to limited range of data type [-Wtype-limits] Source code is if (priority < 0) { but u8 tc, priority, priority_map; Regards David Binderman

linux-4.6/net/kcm/kcmsock.c:1508: bad if test ?

2016-05-16 Thread David Binderman
Hello there, linux-4.6/net/kcm/kcmsock.c:1508]: (style) Checking if unsigned variable 'copied' is less than zero. Source code is if (copied < 0) { but size_t copied; Suggest code rework. Regards David Binderman

linux-4.6/net/kcm/kcmsock.c:1508: bad if test ?

2016-05-16 Thread David Binderman
Hello there, linux-4.6/net/kcm/kcmsock.c:1508]: (style) Checking if unsigned variable 'copied' is less than zero. Source code is if (copied < 0) { but size_t copied; Suggest code rework. Regards David Binderman

drivers/misc/mei/hbm.c:1212: bad if test ?

2015-09-11 Thread David Binderman
  if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS ||     dev->hbm_state>= MEI_HBM_STOPPED) { Regards David Binderman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vg

drivers/misc/mei/hbm.c:1212: bad if test ?

2015-09-11 Thread David Binderman
  if (dev->hbm_state <= MEI_HBM_ENUM_CLIENTS ||     dev->hbm_state>= MEI_HBM_STOPPED) { Regards David Binderman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vg

linux-4.2-rc6/drivers/extcon/extcon.c: 3 * bad tests ?

2015-08-09 Thread David Binderman
ate. Regards David Binderman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the

linux-4.2-rc6/drivers/extcon/extcon.c: 3 * bad tests ?

2015-08-09 Thread David Binderman
. Regards David Binderman -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http

RE: linux-4.1-rc7/drivers/irqchip/irq-renesas-intc-irqpin.c:418: array index used before limits check ?

2015-06-08 Thread David Binderman
t; code. After a deeper look at the code, agreed. False positive by the tool. I also checked the rest of the /irqchip/ directory for other messages by the tool and couldn't see anything else suspicious. Regards David Binderman -- To unsubscribe

RE: linux-4.1-rc7/drivers/irqchip/irq-renesas-intc-irqpin.c:418: array index used before limits check ?

2015-06-08 Thread David Binderman
>> Suggest sanity check array index before use. > > Which version of gcc is being stupid here? None of them. The original "(style)" message is from a static analysis tool called cppcheck. I can't think of a situation where, if an array index needs checki

linux-4.1-rc7/drivers/irqchip/irq-renesas-intc-irqpin.c:418: array index used before limits check ?

2015-06-08 Thread David Binderman
Hello there, [linux-4.1-rc7/drivers/irqchip/irq-renesas-intc-irqpin.c:418]: (style) Array ind ex 'k' is used before limits check.    if (!io[k] && k < INTC_IRQPIN_REG_NR_MANDATORY) { Suggest sanity check array index before use. Regards Davi

linux-4.1-rc7/drivers/irqchip/irq-renesas-intc-irqpin.c:418: array index used before limits check ?

2015-06-08 Thread David Binderman
Hello there, [linux-4.1-rc7/drivers/irqchip/irq-renesas-intc-irqpin.c:418]: (style) Array ind ex 'k' is used before limits check.    if (!io[k] k INTC_IRQPIN_REG_NR_MANDATORY) { Suggest sanity check array index before use. Regards David Binderman

RE: linux-4.1-rc7/drivers/irqchip/irq-renesas-intc-irqpin.c:418: array index used before limits check ?

2015-06-08 Thread David Binderman
of gcc is being stupid here? None of them. The original (style) message is from a static analysis tool called cppcheck. I can't think of a situation where, if an array index needs checking, then it should be checked *after* use. Regards David Binderman

RE: linux-4.1-rc7/drivers/irqchip/irq-renesas-intc-irqpin.c:418: array index used before limits check ?

2015-06-08 Thread David Binderman
by the tool. I also checked the rest of the /irqchip/ directory for other messages by the tool and couldn't see anything else suspicious. Regards David Binderman -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message

[PATCH] lib: Add 64 bit speedup to lib/sort.c

2014-08-06 Thread David Binderman
Hello there, The following patch adds an obvious speedup for 64 bit data to lib/sort.c In tests on a 64 bit machine, the code at the end of the lib/sort.c file executed some 40% faster. The patch is against kernel version 3.16-rc6 Regards David Binderman Signed-off-by: David Binderman

[PATCH] lib: Add 64 bit speedup to lib/sort.c

2014-08-06 Thread David Binderman
Hello there, The following patch adds an obvious speedup for 64 bit data to lib/sort.c In tests on a 64 bit machine, the code at the end of the lib/sort.c file executed some 40% faster. The patch is against kernel version 3.16-rc6 Regards David Binderman Signed-off-by: David Binderman dcb