Skip to content

Commit dbf07b5

Browse files
committed
crypto: ccp: Get rid of __sev_platform_init_locked()'s local function pointer
Add a wrapper instead. No functional changes. Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20230307192449.24732-9-bp@alien8.de
1 parent efb339a commit dbf07b5

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

drivers/crypto/ccp/sev-dev.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,18 @@ static int __sev_init_ex_locked(int *error)
442442
return __sev_do_cmd_locked(SEV_CMD_INIT_EX, &data, error);
443443
}
444444

445+
static inline int __sev_do_init_locked(int *psp_ret)
446+
{
447+
if (sev_init_ex_buffer)
448+
return __sev_init_ex_locked(psp_ret);
449+
else
450+
return __sev_init_locked(psp_ret);
451+
}
452+
445453
static int __sev_platform_init_locked(int *error)
446454
{
447455
int rc = 0, psp_ret = SEV_RET_NO_FW_CALL;
448456
struct psp_device *psp = psp_master;
449-
int (*init_function)(int *error);
450457
struct sev_device *sev;
451458

452459
if (!psp || !psp->sev_data)
@@ -458,15 +465,12 @@ static int __sev_platform_init_locked(int *error)
458465
return 0;
459466

460467
if (sev_init_ex_buffer) {
461-
init_function = __sev_init_ex_locked;
462468
rc = sev_read_init_ex_file();
463469
if (rc)
464470
return rc;
465-
} else {
466-
init_function = __sev_init_locked;
467471
}
468472

469-
rc = init_function(&psp_ret);
473+
rc = __sev_do_init_locked(&psp_ret);
470474
if (rc && psp_ret == SEV_RET_SECURE_DATA_INVALID) {
471475
/*
472476
* Initialization command returned an integrity check failure
@@ -477,7 +481,7 @@ static int __sev_platform_init_locked(int *error)
477481
*/
478482
dev_err(sev->dev,
479483
"SEV: retrying INIT command because of SECURE_DATA_INVALID error. Retrying once to reset PSP SEV state.");
480-
rc = init_function(&psp_ret);
484+
rc = __sev_do_init_locked(&psp_ret);
481485
}
482486

483487
if (error)

0 commit comments

Comments
 (0)