Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ptp: kvm: x86: Return EOPNOTSUPP instead of ENODEV from kvm_arch_ptp_init()

The caller, ptp_kvm_init(), emits a warning if kvm_arch_ptp_init() exits
with any error which is not EOPNOTSUPP:

"fail to initialize ptp_kvm"

Replace ENODEV with EOPNOTSUPP to avoid this spurious warning,
aligning with the ARM implementation.

Fixes: a86ed2cfa13c ("ptp: Don't print an error if ptp_kvm is not supported")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://patch.msgid.link/20241203-kvm_ptp-eopnotsuppp-v2-1-d1d060f27aa6@weissschuh.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Thomas Weißschuh and committed by
Jakub Kicinski
5e7aa97c bd0c9070

+3 -3
+3 -3
drivers/ptp/ptp_kvm_x86.c
··· 26 26 long ret; 27 27 28 28 if (!kvm_para_available()) 29 - return -ENODEV; 29 + return -EOPNOTSUPP; 30 30 31 31 if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT)) { 32 32 p = alloc_page(GFP_KERNEL | __GFP_ZERO); ··· 46 46 47 47 clock_pair_gpa = slow_virt_to_phys(clock_pair); 48 48 if (!pvclock_get_pvti_cpu0_va()) { 49 - ret = -ENODEV; 49 + ret = -EOPNOTSUPP; 50 50 goto err; 51 51 } 52 52 53 53 ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING, clock_pair_gpa, 54 54 KVM_CLOCK_PAIRING_WALLCLOCK); 55 55 if (ret == -KVM_ENOSYS) { 56 - ret = -ENODEV; 56 + ret = -EOPNOTSUPP; 57 57 goto err; 58 58 } 59 59