1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
From 679a5be6f06b909adccc9c588feb26bf6d6df402 Mon Sep 17 00:00:00 2001
From: Kurt Mahan <kmahan@freescale.com>
Date: Thu, 6 Dec 2007 16:40:39 -0700
Subject: [PATCH] Add zero length checking to cache routines.
LTIBName: mcfv4e-cache-ck-0-len
Signed-off-by: Kurt Mahan <kmahan@freescale.com>
---
include/asm-m68k/cf_cacheflush.h | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
--- a/include/asm-m68k/cf_cacheflush.h
+++ b/include/asm-m68k/cf_cacheflush.h
@@ -127,7 +127,9 @@ static inline void flush_bcache(void)
static inline void cf_cache_clear(unsigned long paddr, int len)
{
/* number of lines */
- len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
+ len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
+ if (len == 0)
+ return;
/* align on set boundary */
paddr &= 0xfffffff0;
@@ -161,7 +163,9 @@ static inline void cf_cache_clear(unsign
static inline void cf_cache_push(unsigned long paddr, int len)
{
/* number of lines */
- len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
+ len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
+ if (len == 0)
+ return;
/* align on set boundary */
paddr &= 0xfffffff0;
@@ -195,7 +199,9 @@ static inline void cf_cache_push(unsigne
static inline void cf_cache_flush(unsigned long paddr, int len)
{
/* number of lines */
- len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
+ len = (len + (CACHE_LINE_SIZE-1)) / CACHE_LINE_SIZE;
+ if (len == 0)
+ return;
/* align on set boundary */
paddr &= 0xfffffff0;
@@ -234,6 +240,8 @@ static inline void cf_cache_flush_range(
vstart &= 0xfffffff0;
vend = PAGE_ALIGN((vend + (CACHE_LINE_SIZE-1))) & 0xfffffff0;
len = vend - vstart;
+ if (len == 0)
+ return;
vstart = __pa(vstart);
vend = vstart + len;
|