Re: [PATCH 2/2] ptp: ptp_s390: Add missing facility check
From: Heiko Carstens
Date: Tue Jul 14 2026 - 05:39:35 EST
On Tue, Jul 14, 2026 at 10:49:21AM +0200, Sven Schnelle wrote:
> Only register the physical clock when facility 28 is installed.
>
> Fixes: 2d7de7a3010d ("s390/time: Add PtP driver")
> Signed-off-by: Sven Schnelle <svens@xxxxxxxxxxxxx>
> Cc: stable@xxxxxxxxxx
> ---
> drivers/ptp/ptp_s390.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ptp/ptp_s390.c b/drivers/ptp/ptp_s390.c
> index 7299c3aae65f..3ea94648cdde 100644
> --- a/drivers/ptp/ptp_s390.c
> +++ b/drivers/ptp/ptp_s390.c
> @@ -108,6 +108,9 @@ static __init int ptp_s390_init(void)
> if (IS_ERR(ptp_stcke_clock))
> return PTR_ERR(ptp_stcke_clock);
>
> + if (!test_facility(28))
> + return 0;
> +
> ptp_qpt_clock = ptp_clock_register(&ptp_s390_qpt_info, NULL);
> if (IS_ERR(ptp_qpt_clock)) {
> ptp_clock_unregister(ptp_stcke_clock);
Wouldn't it make more sense to check if PTFF-QPT is available via PTFF-QAF
before registering the clock? This would also avoid the need of the first
patch - since then it is guaranteed that PTFF-QPT will always return with
condition code zero.
And... we wouldn't have the potential oddity to have a clock registered which
doesn't work.