]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ptp: ptp_s390: Add missing facility check
authorSven Schnelle <svens@linux.ibm.com>
Tue, 14 Jul 2026 13:03:42 +0000 (15:03 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 23 Jul 2026 14:02:34 +0000 (07:02 -0700)
Only register the physical clock when facility 28 is installed
and PTFF QAF returns that PTFF QPT is available.

Fixes: 2d7de7a3010d ("s390/time: Add PtP driver")
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Cc: stable@kernel.org
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Link: https://patch.msgid.link/20260714130342.1971700-3-svens@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/ptp/ptp_s390.c

index 29618eb9bf442c23c99a7bee9c777876afe0db14..02d624d89a0abf5708d8e6cfe320ba22abe6ccf7 100644 (file)
@@ -107,6 +107,9 @@ static __init int ptp_s390_init(void)
        if (IS_ERR(ptp_stcke_clock))
                return PTR_ERR(ptp_stcke_clock);
 
+       if (!test_facility(28) || !ptff_query(PTFF_QPT))
+               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);
@@ -117,7 +120,8 @@ static __init int ptp_s390_init(void)
 
 static __exit void ptp_s390_exit(void)
 {
-       ptp_clock_unregister(ptp_qpt_clock);
+       if (ptp_qpt_clock)
+               ptp_clock_unregister(ptp_qpt_clock);
        ptp_clock_unregister(ptp_stcke_clock);
 }