If the configuration hasn't specified this parameter the rest of the new RTC functionality should just be ignored. Fixes: 59348401ebed ("platform/x86: amd-pmc: Add special handling for timer based S0i3 wakeup") Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx> --- drivers/platform/x86/amd-pmc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c index 678bf6874c63..95cb724918e0 100644 --- a/drivers/platform/x86/amd-pmc.c +++ b/drivers/platform/x86/amd-pmc.c @@ -416,7 +416,7 @@ static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev) static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg) { - struct rtc_device *rtc_device; + struct rtc_device *rtc_device = NULL; time64_t then, now, duration; struct rtc_wkalrm alarm; struct rtc_time tm; @@ -425,7 +425,9 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg) if (pdev->major < 64 || (pdev->major == 64 && pdev->minor < 53)) return 0; +#ifdef CONFIG_RTC_SYSTOHC rtc_device = rtc_class_open(CONFIG_RTC_SYSTOHC_DEVICE); +#endif if (!rtc_device) return 0; rc = rtc_read_alarm(rtc_device, &alarm); -- 2.25.1