Category: Linux

Staging: rtl8712: Use ARRAY_SIZE macro

Author: Shraddha Barke <shraddha.6596@gmail.com> ARRAY_SIZE is more concise to use when the size of an array is divided by the size of its type Changes made using Coccinelle- @@ type T; T[] E; @@ – (sizeof(E)/sizeof(T)) + ARRAY_SIZE(E) Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman — drivers/staging/rtl8712/usb_intf.c | 3 +– 1 file changed, 1 insertion(+), 2 …

Continue reading

Staging: sm750fb: Use ARRAY_SIZE macro

Author: Shraddha Barke <shraddha.6596@gmail.com> ARRAY_SIZE is more concise to use when the size of an array is divided by the size of its first element. Changes made using Coccinelle- @@ type T; T[] E; @@ – (sizeof(E)/sizeof(E[…])) + ARRAY_SIZE(E) Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman — drivers/staging/sm750fb/ddk750_chip.c | 4 ++– 1 file changed, 2 insertions(+), …

Continue reading

thermal: exynos: Directly return 0 instead of using local ret variable

Author: Krzysztof Kozlowski <k.kozlowski@samsung.com> The ‘ret’ variable in exynos5440_tmu_initialize() is initialized to 0 and returned as is. Replace it with direct return statement. This also fixes coccinelle warning: drivers/thermal/samsung/exynos_tmu.c:611:5-8: Unneeded variable: “ret”. Return “0” on line 654 Reviewed-by: Alim Akhtar Acked-by: Lukasz Majewski Tested-by: Lukasz Majewski Signed-off-by: Krzysztof Kozlowski Signed-off-by: Eduardo Valentin — drivers/thermal/samsung/exynos_tmu.c | …

Continue reading

Staging: speakup: Use ARRAY_SIZE macro

Author: Shraddha Barke <shraddha.6596@gmail.com> ARRAY_SIZE is more concise to use when the size of an array is divided by the size of its type or the size of its first element. Changes made using Coccinelle- @@ type T; T[] E; @@ – (sizeof(E)/sizeof(T)) + ARRAY_SIZE(E) Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman — drivers/staging/speakup/i18n.c | 2 …

Continue reading

staging: wilc1000: avoid NULL pointer dereference on error

Author: Vincent StehlĂ© <vincent.stehle@laposte.net> The host_int_init() function can dereference the pstrWFIDrv pointer while it is NULL on its error path. Jump directly to the _fail_ error label in the end of the error handling path to avoid that. By doing that we also skip stopping our kthread and destroying our message queue, but they were …

Continue reading

perf tools: Fix handling read result using a signed variable

Author: Andrzej Hajda <a.hajda@samsung.com> The function can return negative value, assigning it to unsigned variable can cause memory corruption. The problem has been detected using proposed semantic patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576 Signed-off-by: Andrzej Hajda Cc: Bartlomiej Zolnierkiewicz Cc: Marek Szyprowski Cc: Peter Zijlstra Cc: kernel-janitors@vger.kernel.org Link: http://lkml.kernel.org/r/1444122017-16856-1-git-send-email-a.hajda@samsung.com Signed-off-by: Arnaldo Carvalho de Melo — tools/perf/util/event.c …

Continue reading

mmc: sdhci-pci: fix simple_return.cocci warnings

Author: kbuild test robot <lkp@intel.com> drivers/mmc/host/sdhci-pci-core.c:447:1-4: WARNING: end returns can be simpified Simplify a trivial if-return sequence. Possibly combine with a preceding function call. Generated by: scripts/coccinelle/misc/simple_return.cocci CC: Ben Hutchings Signed-off-by: Fengguang Wu Signed-off-by: Ulf Hansson — drivers/mmc/host/sdhci-pci-core.c | 6 +—– 1 file changed, 1 insertion(+), 5 deletions(-)   diff –git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c index b3b0a3e..6d86dc8 …

Continue reading

Staging: wilc1000: host_interface: Replace memset with eth_zero_addr

Author: Shraddha Barke <shraddha.6596@gmail.com> Use eth_zero_addr to assign the zero address to the given address array instead of memset when second argument is address of zero. The Coccinelle patch used – // @eth_zero_addr@ expression e; @@ -memset(e,0x00,ETH_ALEN); +eth_zero_addr(e); // Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman — drivers/staging/wilc1000/host_interface.c | 13 +++++++—— 1 file changed, 7 insertions(+), …

Continue reading

Staging: wilc1000: wilc_wfi_cfgoperations: Replace memset with eth_zero_addr

Author: Shraddha Barke <shraddha.6596@gmail.com> Use eth_zero_addr to assign the zero address to the given address array instead of memset when second argument is address of zero. The Coccinelle patch used – // @eth_zero_addr@ expression e; @@ -memset(e,0x00,ETH_ALEN); +eth_zero_addr(e); // Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman — drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++— 1 file changed, 3 insertions(+), …

Continue reading

Staging: most: Use module_platform_driver

Author: Shraddha Barke <shraddha.6596@gmail.com> Use module_platform_driver for drivers whose init and exit functions only register and unregister, respectively. Thus remove some boilerplate code. A simplified version of Coccinelle patch – @a@ identifier f, x; @@ -static f(…) { return platform_driver_register(&x); } @b depends on a@ identifier e, a.x; @@ -static e(…) { platform_driver_unregister(&x); } @c …

Continue reading