Skip to content

Commit

Permalink
time: Use ARRAY_SIZE macro in timecompare.c
Browse files Browse the repository at this point in the history
Replace sizeof(buffer)/sizeof(buffer[0]) with ARRAY_SIZE(buffer) in
kernel/time/timecompare.c

Signed-off-by: Nikitas Angelinas <nikitasangelinas@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Nikitas Angelinas authored and Thomas Gleixner committed Oct 21, 2010
1 parent aaabe31 commit 2bf1c05
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/time/timecompare.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2bf1c05

Please sign in to comment.