[tip: timers/cleanups] hrtimers: Remove unnecessary NULL check in hrtimer_start_range_ns()

From: tip-bot2 for Nam Cao
Date: Fri Apr 04 2025 - 13:35:14 EST


The following commit has been merged into the timers/cleanups branch of tip:

Commit-ID: e767a548b68989ed3f4e4904ef50847f8b5ccd7c
Gitweb: https://git.kernel.org/tip/e767a548b68989ed3f4e4904ef50847f8b5ccd7c
Author: Nam Cao <namcao@xxxxxxxxxxxxx>
AuthorDate: Wed, 05 Feb 2025 11:55:17 +01:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
CommitterDate: Fri, 04 Apr 2025 19:26:44 +02:00

hrtimers: Remove unnecessary NULL check in hrtimer_start_range_ns()

The 'function' field of struct hrtimer can only be changed using
hrtimer_setup*() or hrtimer_update_function(), and both already null-check
'function'. Therefore, null-checking 'function' in hrtimer_start_range_ns()
is not necessary.

Signed-off-by: Nam Cao <namcao@xxxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/all/4661c571ee87980c340ccc318fc1a473c0c8f6bc.1738746927.git.namcao@xxxxxxxxxxxxx

---
kernel/time/hrtimer.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 88ea4bb..e883f65 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1316,8 +1316,6 @@ void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
struct hrtimer_clock_base *base;
unsigned long flags;

- if (WARN_ON_ONCE(!ACCESS_PRIVATE(timer, function)))
- return;
/*
* Check whether the HRTIMER_MODE_SOFT bit and hrtimer.is_soft
* match on CONFIG_PREEMPT_RT = n. With PREEMPT_RT check the hard