From: Ard Biesheuvel Date: Fri, 17 Feb 2023 14:23:38 +0000 (+0100) Subject: rtc: efi: Avoid spamming the log on RTC read failure X-Git-Tag: v6.6.7~3355^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=668a2abf91143caa226b3ccd0bd4d79ea85935a6;p=platform%2Fkernel%2Flinux-starfive.git rtc: efi: Avoid spamming the log on RTC read failure There are cases where the EFI runtime services may end up in a funny state, e.g., due to a crash in the variable services, and this affects other EFI runtime services as well. That means that, even though GetTime() should not return an error, there are cases where it might, and there is no point in logging such an occurrence multiple times. This works around an issue where user space -apparently- keeps hitting on /dev/rtc if it fails to read the h/w clock, resulting in a tsunami of log spam and a non-responsive system as a result. Cc: Pierre Gondois Cc: Alexandru Elisei Link: https://lore.kernel.org/all/Y2o1hdZK9GGDVJsS@monolith.localdoman/ Signed-off-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20230217142338.1444509-1-ardb@kernel.org Signed-off-by: Alexandre Belloni --- diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index 1e8bc6c..dc6b0f4 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c @@ -164,7 +164,7 @@ static int efi_read_time(struct device *dev, struct rtc_time *tm) if (status != EFI_SUCCESS) { /* should never happen */ - dev_err(dev, "can't read time\n"); + dev_err_once(dev, "can't read time\n"); return -EINVAL; }