Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1725359

[PATCH 6/6] x86/platform/intel-mid: Use ARRAY_SIZE macro

From Thomas Meyer <thomas@m3y3r.de>
Newsgroups linux.kernel
Subject [PATCH 6/6] x86/platform/intel-mid: Use ARRAY_SIZE macro
Date 2017-09-01 23:40 +0200
Message-ID <ul1Ps-2fo-23@gated-at.bofh.it> (permalink)
References <ul1Pr-2fo-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Found by a coccinelle run with:
make coccicheck MODE=patch COCCI=scripts/coccinelle/misc/array_size.cocci

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---
 arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c b/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c
index 74283875c7e8..8e2fbd35a9e6 100644
--- a/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c
+++ b/arch/x86/platform/intel-mid/device_libs/platform_gpio_keys.c
@@ -64,7 +64,7 @@ static int __init pb_keys_init(void)
 	struct gpio_keys_button *gb = gpio_button;
 	int i, num, good = 0;
 
-	num = sizeof(gpio_button) / sizeof(struct gpio_keys_button);
+	num = ARRAY_SIZE(gpio_button);
 	for (i = 0; i < num; i++) {
 		gb[i].gpio = get_gpio_by_name(gb[i].desc);
 		pr_debug("info[%2d]: name = %s, gpio = %d\n", i, gb[i].desc,
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/6] perf tools: Use ARRAY_SIZE macro Thomas Meyer <thomas@m3y3r.de> - 2017-09-01 23:40 +0200
  [PATCH 6/6] x86/platform/intel-mid: Use ARRAY_SIZE macro Thomas Meyer <thomas@m3y3r.de> - 2017-09-01 23:40 +0200
  [PATCH 3/6] ia64: Use ARRAY_SIZE macro Thomas Meyer <thomas@m3y3r.de> - 2017-09-01 23:40 +0200

csiph-web