Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/rtas-rtc: remove sideeffects of printk_ratelimit

Don't use printk_ratelimit() as an additional condition for returning
on an error. Because when the ratelimit is reached, printk_ratelimit
will return 0 and e.g. in rtas_get_boot_time won't check for an error
condition.

Signed-off-by: Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Christian Dietrich and committed by
Benjamin Herrenschmidt
9a8f99fa 937c190c

+17 -12
+17 -12
arch/powerpc/kernel/rtas-rtc.c
··· 4 4 #include <linux/init.h> 5 5 #include <linux/rtc.h> 6 6 #include <linux/delay.h> 7 + #include <linux/ratelimit.h> 7 8 #include <asm/prom.h> 8 9 #include <asm/rtas.h> 9 10 #include <asm/time.h> ··· 30 29 } 31 30 } while (wait_time && (get_tb() < max_wait_tb)); 32 31 33 - if (error != 0 && printk_ratelimit()) { 34 - printk(KERN_WARNING "error: reading the clock failed (%d)\n", 35 - error); 32 + if (error != 0) { 33 + printk_ratelimited(KERN_WARNING 34 + "error: reading the clock failed (%d)\n", 35 + error); 36 36 return 0; 37 37 } 38 38 ··· 57 55 58 56 wait_time = rtas_busy_delay_time(error); 59 57 if (wait_time) { 60 - if (in_interrupt() && printk_ratelimit()) { 58 + if (in_interrupt()) { 61 59 memset(rtc_tm, 0, sizeof(struct rtc_time)); 62 - printk(KERN_WARNING "error: reading clock" 63 - " would delay interrupt\n"); 60 + printk_ratelimited(KERN_WARNING 61 + "error: reading clock " 62 + "would delay interrupt\n"); 64 63 return; /* delay not allowed */ 65 64 } 66 65 msleep(wait_time); 67 66 } 68 67 } while (wait_time && (get_tb() < max_wait_tb)); 69 68 70 - if (error != 0 && printk_ratelimit()) { 71 - printk(KERN_WARNING "error: reading the clock failed (%d)\n", 72 - error); 69 + if (error != 0) { 70 + printk_ratelimited(KERN_WARNING 71 + "error: reading the clock failed (%d)\n", 72 + error); 73 73 return; 74 74 } 75 75 ··· 103 99 } 104 100 } while (wait_time && (get_tb() < max_wait_tb)); 105 101 106 - if (error != 0 && printk_ratelimit()) 107 - printk(KERN_WARNING "error: setting the clock failed (%d)\n", 108 - error); 102 + if (error != 0) 103 + printk_ratelimited(KERN_WARNING 104 + "error: setting the clock failed (%d)\n", 105 + error); 109 106 110 107 return 0; 111 108 }