summaryrefslogtreecommitdiff
path: root/kernel/range.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/range.c')
-rw-r--r--kernel/range.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/kernel/range.c b/kernel/range.c
index 322ea8e93e4b..56435f96da73 100644
--- a/kernel/range.c
+++ b/kernel/range.c
@@ -1,8 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Range add and subtract
*/
-#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/minmax.h>
+#include <linux/printk.h>
#include <linux/sort.h>
#include <linux/string.h>
#include <linux/range.h>
@@ -113,12 +115,12 @@ static int cmp_range(const void *x1, const void *x2)
{
const struct range *r1 = x1;
const struct range *r2 = x2;
- s64 start1, start2;
- start1 = r1->start;
- start2 = r2->start;
-
- return start1 - start2;
+ if (r1->start < r2->start)
+ return -1;
+ if (r1->start > r2->start)
+ return 1;
+ return 0;
}
int clean_sort_range(struct range *range, int az)