linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ptp: fix error print of ptp_kvm on X86_64 platform
@ 2021-10-14  3:19 Kele Huang
  2021-10-15 10:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Kele Huang @ 2021-10-14  3:19 UTC (permalink / raw)
  To: richardcochran; +Cc: xieyongji, huangkele, netdev, linux-kernel

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>
---
 drivers/ptp/ptp_kvm_x86.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ptp/ptp_kvm_x86.c b/drivers/ptp/ptp_kvm_x86.c
index d0096cd7096a..4991054a2135 100644
--- a/drivers/ptp/ptp_kvm_x86.c
+++ b/drivers/ptp/ptp_kvm_x86.c
@@ -31,10 +31,10 @@ int kvm_arch_ptp_init(void)
 
 	ret = kvm_hypercall2(KVM_HC_CLOCK_PAIRING, clock_pair_gpa,
 			     KVM_CLOCK_PAIRING_WALLCLOCK);
-	if (ret == -KVM_ENOSYS || ret == -KVM_EOPNOTSUPP)
+	if (ret == -KVM_ENOSYS)
 		return -ENODEV;
 
-	return 0;
+	return ret;
 }
 
 int kvm_arch_ptp_get_clock(struct timespec64 *ts)
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ptp: fix error print of ptp_kvm on X86_64 platform
  2021-10-14  3:19 [PATCH] ptp: fix error print of ptp_kvm on X86_64 platform Kele Huang
@ 2021-10-15 10:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-15 10:20 UTC (permalink / raw)
  To: Kele Huang; +Cc: richardcochran, xieyongji, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 14 Oct 2021 11:19:52 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - ptp: fix error print of ptp_kvm on X86_64 platform
    https://git.kernel.org/netdev/net/c/c2402d43d183

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-15 10:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-14  3:19 [PATCH] ptp: fix error print of ptp_kvm on X86_64 platform Kele Huang
2021-10-15 10:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).