mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 22:50:41 +00:00
time: Use ARRAY_SIZE macro in timecompare.c
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>
This commit is contained in:
parent
aaabe31c25
commit
2bf1c05e3c
@ -21,6 +21,7 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fixed point arithmetic scale factor for skew
|
* fixed point arithmetic scale factor for skew
|
||||||
@ -57,11 +58,11 @@ int timecompare_offset(struct timecompare *sync,
|
|||||||
int index;
|
int index;
|
||||||
int num_samples = sync->num_samples;
|
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);
|
samples = kmalloc(sizeof(*samples) * num_samples, GFP_ATOMIC);
|
||||||
if (!samples) {
|
if (!samples) {
|
||||||
samples = buffer;
|
samples = buffer;
|
||||||
num_samples = sizeof(buffer)/sizeof(buffer[0]);
|
num_samples = ARRAY_SIZE(buffer);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
samples = buffer;
|
samples = buffer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user