Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH][MIPS] fix divide by zero error in build_clear_page and build_copy_page
@ 2008-05-07 14:38 Yoichi Yuasa
  2008-05-07 16:14 ` Maciej W. Rozycki
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Yoichi Yuasa @ 2008-05-07 14:38 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: yoichi_yuasa, linux-mips

Fix divide by zero error in build_clear_page() and build_copy_page()

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X /home/yuasa/Memo/dontdiff linux-orig/arch/mips/mm/page.c linux/arch/mips/mm/page.c
--- linux-orig/arch/mips/mm/page.c	2008-05-07 10:28:03.732151097 +0900
+++ linux/arch/mips/mm/page.c	2008-05-07 23:27:00.212977534 +0900
@@ -310,8 +310,8 @@ void __cpuinit build_clear_page(void)
 	if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x())
 		uasm_i_lui(&buf, AT, 0xa000);
 
-	off = min(8, pref_bias_clear_store / cache_line_size) *
-	      cache_line_size;
+	off = cache_line_size ? min(8, pref_bias_clear_store / cache_line_size)
+	                        * cache_line_size : 0;
 	while (off) {
 		build_clear_pref(&buf, -off);
 		off -= cache_line_size;
@@ -454,12 +454,14 @@ void __cpuinit build_copy_page(void)
 	if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x())
 		uasm_i_lui(&buf, AT, 0xa000);
 
-	off = min(8, pref_bias_copy_load / cache_line_size) * cache_line_size;
+	off = cache_line_size ? min(8, pref_bias_copy_load / cache_line_size) *
+	                        cache_line_size : 0;
 	while (off) {
 		build_copy_load_pref(&buf, -off);
 		off -= cache_line_size;
 	}
-	off = min(8, pref_bias_copy_store / cache_line_size) * cache_line_size;
+	off = cache_line_size ? min(8, pref_bias_copy_load / cache_line_size) *
+	                        cache_line_size : 0;
 	while (off) {
 		build_copy_store_pref(&buf, -off);
 		off -= cache_line_size;

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-06-13 13:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-07 14:38 [PATCH][MIPS] fix divide by zero error in build_clear_page and build_copy_page Yoichi Yuasa
2008-05-07 16:14 ` Maciej W. Rozycki
2008-05-07 22:38   ` Yoichi Yuasa
2008-05-07 23:04     ` Maciej W. Rozycki
2008-05-09  8:49       ` Ralf Baechle
2008-05-15 10:00 ` Ralf Baechle
2008-05-30  4:07 ` Atsushi Nemoto
2008-06-13 13:19   ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox