wifi: iwlwifi: handle NULL/ERR returns from ptp_clock_register()

ptp_clock_register() returns NULL when PTP support is disabled and may
return an ERR_PTR() on other failures. Reduce Log severity for NULL
return cases to avoid misleading errors when PTP is unavailable.

Signed-off-by: Avinash Bhatt <avinash.bhatt@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260321192637.adea594600e8.I0e3d3f7ce897c54fff8ace6dd0faf55b4f39832b@changeid
This commit is contained in:
Avinash Bhatt 2026-03-21 19:29:11 +02:00 committed by Miri Korenblit
parent 350d91a2ae
commit 19a86a3ff3
2 changed files with 6 additions and 2 deletions

View File

@ -301,10 +301,12 @@ void iwl_mld_ptp_init(struct iwl_mld *mld)
mld->ptp_data.ptp_clock =
ptp_clock_register(&mld->ptp_data.ptp_clock_info, mld->dev);
if (IS_ERR_OR_NULL(mld->ptp_data.ptp_clock)) {
if (IS_ERR(mld->ptp_data.ptp_clock)) {
IWL_ERR(mld, "Failed to register PHC clock (%ld)\n",
PTR_ERR(mld->ptp_data.ptp_clock));
mld->ptp_data.ptp_clock = NULL;
} else if (!mld->ptp_data.ptp_clock) {
IWL_DEBUG_INFO(mld, "PTP module unavailable on this kernel\n");
} else {
IWL_DEBUG_INFO(mld, "Registered PHC clock: %s, with index: %d\n",
mld->ptp_data.ptp_clock_info.name,

View File

@ -304,7 +304,9 @@ void iwl_mvm_ptp_init(struct iwl_mvm *mvm)
IWL_ERR(mvm, "Failed to register PHC clock (%ld)\n",
PTR_ERR(mvm->ptp_data.ptp_clock));
mvm->ptp_data.ptp_clock = NULL;
} else if (mvm->ptp_data.ptp_clock) {
} else if (!mvm->ptp_data.ptp_clock) {
IWL_DEBUG_INFO(mvm, "PTP module unavailable on this kernel\n");
} else {
IWL_DEBUG_INFO(mvm, "Registered PHC clock: %s, with index: %d\n",
mvm->ptp_data.ptp_clock_info.name,
ptp_clock_index(mvm->ptp_data.ptp_clock));