Re: [PATCH] ftrace:fix check for return value ofregister_module_notifier

From: Frederic Weisbecker
Date: Sun May 17 2009 - 09:06:23 EST


On Sun, May 17, 2009 at 03:31:38PM +0800, tom.leiming@xxxxxxxxx wrote:
> From: Ming Lei <tom.leiming@xxxxxxxxx>
>
> return zero should be correct, so fix it.
>
> Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx>
> ---
> kernel/trace/ftrace.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 5b606f4..140699a 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -2826,7 +2826,7 @@ void __init ftrace_init(void)
> __stop_mcount_loc);
>
> ret = register_module_notifier(&ftrace_module_nb);
> - if (!ret)
> + if (ret)
> pr_warning("Failed to register trace ftrace module notifier\n");
>
> return;


Indeed!

register_module_notifier returns blocking_notifier_chain_register():

*
* Currently always returns zero.
*/
int blocking_notifier_chain_register(struct blocking_notifier_head *nh,
struct notifier_block *n)

For now it will never return anything else than 0 but we can keep
the warning in case it changes one day, as you did.

Acked-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/