lkml.org 
[lkml]   [2016]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Input: synaptics-rmi4: fix array_size.cocci warnings
drivers/input/rmi4/rmi_bus.c:295:20-21: WARNING: Use ARRAY_SIZE

Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element

Semantic patch information:
This makes an effort to find cases where ARRAY_SIZE can be used such as
where there is a division of sizeof the array by the sizeof its first
element or by any indexed element or the element type. It replaces the
division of the two sizeofs by ARRAY_SIZE.

Generated by: scripts/coccinelle/misc/array_size.cocci

CC: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

rmi_bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/input/rmi4/rmi_bus.c
+++ b/drivers/input/rmi4/rmi_bus.c
@@ -292,7 +292,7 @@ static struct rmi_function_handler *fn_h
};

#define RMI_FN_HANDLER_ARRAY_SIZE \
- (sizeof(fn_handlers) / sizeof(struct rmi_function_handler *))
+ ARRAY_SIZE(fn_handlers)

static void __rmi_unregister_function_handlers(int start_idx)
{
\
 
 \ /
  Last update: 2016-02-10 03:41    [W:0.029 / U:2.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site