From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF3D7C4338F for ; Mon, 26 Jul 2021 15:08:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D1F1E60F02 for ; Mon, 26 Jul 2021 15:08:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234868AbhGZO1d (ORCPT ); Mon, 26 Jul 2021 10:27:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:59328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234837AbhGZOYM (ORCPT ); Mon, 26 Jul 2021 10:24:12 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EE37B60F55; Mon, 26 Jul 2021 15:04:40 +0000 (UTC) Date: Mon, 26 Jul 2021 11:04:34 -0400 From: Steven Rostedt To: Jason Wang Cc: mingo@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tracing: use WARN_ONCE Message-ID: <20210726110434.4b9f976d@oasis.local.home> In-Reply-To: <20210726110237.3c25dbc7@oasis.local.home> References: <20210726135635.143285-1-wangborong@cdjrlc.com> <20210726110237.3c25dbc7@oasis.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 26 Jul 2021 11:02:37 -0400 Steven Rostedt wrote: > > @@ -1574,9 +1574,8 @@ __init static int init_events(void) > > > > ret = register_trace_event(event); > > if (!ret) { > > - printk(KERN_WARNING "event %d failed to register\n", > > - event->type); > > - WARN_ON_ONCE(1); > > + WARN_ONCE(1, "event %d failed to register\n", > > + event->type); > > } > > } > > > > If you're going to change this, then nuke the conditional! > > WARN_ONCE(!ret, "event %d failed to register\n", event->type); Oh, and if you are making these types of changes, you need to understand them. The string passed to WARN does not need the "\n" like the printk() does. WARN_ONCE(!ret, "event %d failed to register", event->type); -- Steve