mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kernel: time: use ARRAY_SIZE macro in timecompare.c
@ 2010-08-22 23:43 Nikitas Angelinas
  2010-08-23  1:01 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Nikitas Angelinas @ 2010-08-22 23:43 UTC (permalink / raw)
  To: akpm, davem, 21cnbao, tj; +Cc: linux-kernel, Nikitas Angelinas

Replace sizeof(buffer)/sizeof(buffer[0]) with ARRAY_SIZE(buffer) in
kernel/time/timecompare.c

Signed-off-by: Nikitas Angelinas <nikitasangelinas@googlemail.com>
---
 kernel/time/timecompare.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/time/timecompare.c b/kernel/time/timecompare.c
index ac38fbb..a9ae369 100644
--- a/kernel/time/timecompare.c
+++ b/kernel/time/timecompare.c
@@ -21,6 +21,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/math64.h>
+#include <linux/kernel.h>
 
 /*
  * fixed point arithmetic scale factor for skew
@@ -57,11 +58,11 @@ int timecompare_offset(struct timecompare *sync,
 	int index;
 	int num_samples = sync->num_samples;
 
-	if (num_samples > sizeof(buffer)/sizeof(buffer[0])) {
+	if (num_samples > ARRAY_SIZE(buffer)) {
 		samples = kmalloc(sizeof(*samples) * num_samples, GFP_ATOMIC);
 		if (!samples) {
 			samples = buffer;
-			num_samples = sizeof(buffer)/sizeof(buffer[0]);
+			num_samples = ARRAY_SIZE(buffer);
 		}
 	} else {
 		samples = buffer;
-- 
1.7.1.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-27  7:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-22 23:43 [PATCH] kernel: time: use ARRAY_SIZE macro in timecompare.c Nikitas Angelinas
2010-08-23  1:01 ` Dmitry Torokhov
2010-08-23 23:27   ` Nikitas Angelinas
2010-08-27  7:37     ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®