On Sun, Sep 08, 2019 at 10:16:02AM +0200, Borislav Petkov wrote: > On Sun, Sep 08, 2019 at 10:58:31AM +0300, Hawa, Hanna wrote: > > > Better use WARN_ON_ONCE() to avoid flooding. > > > > In case of two drivers using this function with wrong error count, only the > > first WARN_ON_ONCE will catch in this case, and other will miss other wrong > > usage of other edac device drivers. > > The idea is to catch any driver using a 0 error count and fix it, not to > flood dmesg. You want _ONCE.
... and you want to return early too, i.e., if (WARN_ON_ONCE(!error_count)) return; Frankly, I'd even remove all the warning functionality and simply do if (!error_count) return; but let's see how much it screams first. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette