crypto/ccp: Skip SNP_INIT if preparation fails

If snp_prepare() fails, SNP_INIT will fail, so skip it and return early.

Note that this is not a change in initialization behavior: if SNP_INIT fails
even before this change, it will still return an error and
__sev_snp_init_locked() will fail initialization of other SEV modes.

Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Nikunj A Dadhania <nikunj@amd.com>
Link: https://lore.kernel.org/20260429155636.540040-1-tycho@kernel.org
This commit is contained in:
Tycho Andersen (AMD) authored and Borislav Petkov (AMD) committed 2026-05-08 20:29:40 +02:00
1 parent 39f1de2fff
commit e9d29f4a91
1 file changed
+3 -1
+3 -1
View File
@@ -1374,7 +1374,9 @@ static int __sev_snp_init_locked(int *error, unsigned int max_snp_asid)
return -EOPNOTSUPP;
}
snp_prepare();
rc = snp_prepare();
if (rc)
return rc;
/*
* Starting in SNP firmware v1.52, the SNP_INIT_EX command takes a list