028-mcfv4e_cache_ck_0_len.patch 1.7 KB

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