@@ -2069,7 +2069,7 @@ static int __init snp_get_tsc_info(void)
20692069 struct snp_tsc_info_resp * tsc_resp ;
20702070 struct snp_tsc_info_req * tsc_req ;
20712071 struct snp_msg_desc * mdesc ;
2072- struct snp_guest_req * req ;
2072+ struct snp_guest_req req = {} ;
20732073 int rc = - ENOMEM ;
20742074
20752075 tsc_req = kzalloc (sizeof (* tsc_req ), GFP_KERNEL );
@@ -2085,28 +2085,24 @@ static int __init snp_get_tsc_info(void)
20852085 if (!tsc_resp )
20862086 goto e_free_tsc_req ;
20872087
2088- req = kzalloc (sizeof (* req ), GFP_KERNEL );
2089- if (!req )
2090- goto e_free_tsc_resp ;
2091-
20922088 mdesc = snp_msg_alloc ();
20932089 if (IS_ERR_OR_NULL (mdesc ))
2094- goto e_free_req ;
2090+ goto e_free_tsc_resp ;
20952091
20962092 rc = snp_msg_init (mdesc , snp_vmpl );
20972093 if (rc )
20982094 goto e_free_mdesc ;
20992095
2100- req -> msg_version = MSG_HDR_VER ;
2101- req -> msg_type = SNP_MSG_TSC_INFO_REQ ;
2102- req -> vmpck_id = snp_vmpl ;
2103- req -> req_buf = tsc_req ;
2104- req -> req_sz = sizeof (* tsc_req );
2105- req -> resp_buf = (void * )tsc_resp ;
2106- req -> resp_sz = sizeof (* tsc_resp ) + AUTHTAG_LEN ;
2107- req -> exit_code = SVM_VMGEXIT_GUEST_REQUEST ;
2096+ req . msg_version = MSG_HDR_VER ;
2097+ req . msg_type = SNP_MSG_TSC_INFO_REQ ;
2098+ req . vmpck_id = snp_vmpl ;
2099+ req . req_buf = tsc_req ;
2100+ req . req_sz = sizeof (* tsc_req );
2101+ req . resp_buf = (void * )tsc_resp ;
2102+ req . resp_sz = sizeof (* tsc_resp ) + AUTHTAG_LEN ;
2103+ req . exit_code = SVM_VMGEXIT_GUEST_REQUEST ;
21082104
2109- rc = snp_send_guest_request (mdesc , req );
2105+ rc = snp_send_guest_request (mdesc , & req );
21102106 if (rc )
21112107 goto e_request ;
21122108
@@ -2127,9 +2123,7 @@ static int __init snp_get_tsc_info(void)
21272123 memzero_explicit (tsc_resp , sizeof (* tsc_resp ) + AUTHTAG_LEN );
21282124e_free_mdesc :
21292125 snp_msg_free (mdesc );
2130- e_free_req :
2131- kfree (req );
2132- e_free_tsc_resp :
2126+ e_free_tsc_resp :
21332127 kfree (tsc_resp );
21342128e_free_tsc_req :
21352129 kfree (tsc_req );
0 commit comments