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

ptp: fix error print of ptp_kvm on X86_64 platform

Commit a86ed2cfa13c5 ("ptp: Don't print an error if ptp_kvm is not supported")
fixes the error message print on ARM platform by only concerning about
the case that the error returned from kvm_arch_ptp_init() is not -EOPNOTSUPP.
Although the ARM platform returns -EOPNOTSUPP if ptp_kvm is not supported
while X86_64 platform returns -KVM_EOPNOTSUPP, both error codes share the
same value 95.

Actually kvm_arch_ptp_init() on X86_64 platform can return three kinds of
errors (-KVM_ENOSYS, -KVM_EOPNOTSUPP and -KVM_EFAULT). The problem is that
-KVM_EOPNOTSUPP is masked out and -KVM_EFAULT is ignored among them.
This patch fixes this by returning them to ptp_kvm_init() respectively.

Signed-off-by: Kele Huang <huangkele@bytedance.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Kele Huang and committed by
David S. Miller
c2402d43 ec681c53

+2 -2
+2 -2
drivers/ptp/ptp_kvm_x86.c
··· 31 31 32 32 ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING, clock_pair_gpa, 33 33 KVM_CLOCK_PAIRING_WALLCLOCK); 34 - if (ret == -KVM_ENOSYS || ret == -KVM_EOPNOTSUPP) 34 + if (ret == -KVM_ENOSYS) 35 35 return -ENODEV; 36 36 37 - return 0; 37 + return ret; 38 38 } 39 39 40 40 int kvm_arch_ptp_get_clock(struct timespec64 *ts)