Re: [PATCH] bug: Fix no-return-statement warning with !CONFIG_BUG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Mon, Apr 15, 2024, at 19:07, Christophe Leroy wrote:
> Le 15/04/2024 à 17:35, Arnd Bergmann a écrit :
>> I haven't seen a good solution here. Ideally we'd just define
>> the functions unconditionally and have IS_ENABLED() take care
>> of letting the compiler drop them silently, but that doesn't
>> build because of missing struct members.
>> I won't object to either an 'extern' declaration or the
>> 'BUILD_BUG_ON()' if you and others prefer that, both are better
>> than BUG() here. I still think my suggestion would be a little
>> simpler.
> The advantage of the BUILD_BUG() against the extern is that the error 
> gets detected at buildtime. With the extern it gets detected only at 
> link-time.
> But agree with you, the missing struct members defeats the advantages of 
> At the end, how many instances of struct timekeeper do we have in the 
> system ? With a quick look I see only two instances: tkcore.timekeeper 
> and shadow_timekeeper. If I'm correct, wouldn't it just be simpler to 
> have the three debug struct members defined at all time ?

Sure, this version looks fine to me, and passes a simple build


diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h
index 84ff2844df2a..485677a98b0b 100644
--- a/include/linux/timekeeper_internal.h
+++ b/include/linux/timekeeper_internal.h
@@ -124,7 +124,6 @@ struct timekeeper {
        u32                     ntp_err_mult;
        /* Flag used to avoid updating NTP twice with same second */
        u32                     skip_second_overflow;
        long                    last_warning;
         * These simple flag variables are managed
@@ -135,7 +134,6 @@ struct timekeeper {
        int                     underflow_seen;
        int                     overflow_seen;
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 4e18db1819f8..17f7aed807e1 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -195,7 +195,6 @@ static inline u64 tk_clock_read(const struct tk_read_base *tkr)
        return clock->read(clock);
 #define WARNING_FREQ (HZ*300) /* 5 minute rate-limiting */
 static void timekeeping_check_update(struct timekeeper *tk, u64 offset)
@@ -276,15 +275,6 @@ static inline u64 timekeeping_debug_get_ns(const struct tk_read_base *tkr)
        /* timekeeping_cycles_to_ns() handles both under and overflow */
        return timekeeping_cycles_to_ns(tkr, now);
-static inline void timekeeping_check_update(struct timekeeper *tk, u64 offset)
-static inline u64 timekeeping_debug_get_ns(const struct tk_read_base *tkr)
-       BUG();
  * tk_setup_internals - Set up internals to use clocksource clock.
@@ -2173,7 +2163,8 @@ static bool timekeeping_advance(enum timekeeping_adv_mode mode)
                goto out;
        /* Do some additional sanity checking */
-       timekeeping_check_update(tk, offset);
+               timekeeping_check_update(tk, offset);
         * With NO_HZ we may have to accumulate many cycle_intervals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux