x86/Hyper-V: Initialize Syn timer clock even when it's not available
PATCH 1/1 x86/Hyper-V: Initialize Syn timer clock even when it's not available
From: Tianyu Lan <[email protected]>
Current code initializes clock event data structure for syn timer even when it's available or not. Fix it.
Signed-off-by Tianyu Lan <[email protected]>
--- drivers/hv/hv.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/hv/hv.c +9 -6
@@ -212,13 +212,16 @@ int hv_synic_alloc(void)tasklet_init (&hv_cpu->msg_dpc, vmbus_on_msg_dpc, (unsigned long ) hv_cpu); - hv_cpu->clk_evt =kzalloc (sizeof (struct clock_event_device ), -GFP_KERNEL ); -if (hv_cpu->clk_evt ==NULL ) { -pr_err ("Unable to allocate clock event device\n" ); - goto err; +if (ms_hyperv.features &HV_MSR_SYNTIMER_AVAILABLE ) { + hv_cpu->clk_evt = +kzalloc (sizeof (struct clock_event_device ), +GFP_KERNEL ); +if (hv_cpu->clk_evt ==NULL ) { +pr_err ("Unable to allocate clock event device\n" ); + goto err; + } +hv_init_clockevent_device (hv_cpu->clk_evt, cpu); } -hv_init_clockevent_device (hv_cpu->clk_evt, cpu); hv_cpu->synic_message_page = (void *)get_zeroed_page (GFP_ATOMIC );
Signature · 1 line
2.14.5
Sorry for wrong title. Please ignore it.
Quoted 38 lines · On 3/30/2020 10:09 PM, [email protected] wrote:
From: Tianyu Lan <[email protected]>
Current code initializes clock event data structure for syn timer even when it's available or not. Fix it.
Signed-off-by Tianyu Lan <[email protected]>--- drivers/hv/hv.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)drivers/hv/hv.c +9
-6@@ -212,13 +212,16 @@ int hv_synic_alloc(void)tasklet_init (&hv_cpu->msg_dpc, vmbus_on_msg_dpc, (unsigned long ) hv_cpu); - hv_cpu->clk_evt =kzalloc (sizeof (struct clock_event_device ), -GFP_KERNEL ); -if (hv_cpu->clk_evt ==NULL ) { -pr_err ("Unable to allocate clock event device\n" ); - goto err; +if (ms_hyperv.features &HV_MSR_SYNTIMER_AVAILABLE ) { + hv_cpu->clk_evt = +kzalloc (sizeof (struct clock_event_device ), +GFP_KERNEL ); +if (hv_cpu->clk_evt ==NULL ) { +pr_err ("Unable to allocate clock event device\n" ); + goto err; + } +hv_init_clockevent_device (hv_cpu->clk_evt, cpu); } -hv_init_clockevent_device (hv_cpu->clk_evt, cpu); hv_cpu->synic_message_page = (void *)get_zeroed_page (GFP_ATOMIC );