Re: [PATCH] static_call: Handle module init failure correctly in static_call_del_module()
From: Thomas Gleixner
Date: Wed Sep 04 2024 - 04:01:01 EST
On Wed, Sep 04 2024 at 09:08, Thomas Gleixner wrote:
> On Wed, Sep 04 2024 at 11:32, Jinjie Ruan wrote:
> So the check must be:
>
> if (!static_call_key_has_mods(key))
> break;
>
> I missed the module local case completely in my analysis. Can you please
> modify the condition and retest?
That said. This code is pointlessly noisy for the failure case.
Allocation fails are not a reason to warn about. -ENOMEM is propagated
all the way to the caller, so it's sufficient to emit a pr_warn().
Peter?
Thanks,
tglx
---
--- a/kernel/static_call_inline.c
+++ b/kernel/static_call_inline.c
@@ -453,7 +453,7 @@ static int static_call_module_notify(str
case MODULE_STATE_COMING:
ret = static_call_add_module(mod);
if (ret) {
- WARN(1, "Failed to allocate memory for static calls");
+ pr_warn("Failed to allocate memory for static calls\n");
static_call_del_module(mod);
}
break;