Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp660792imi; Thu, 21 Jul 2022 08:30:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sQ5TfJLNoID5s3+GufiQxIrgSyEr8QFLIekVQgqNXuOpKOqysQ/1YAHA3vFEo5I727DwjF X-Received: by 2002:a63:4047:0:b0:419:7599:9a9c with SMTP id n68-20020a634047000000b0041975999a9cmr38144824pga.23.1658417425558; Thu, 21 Jul 2022 08:30:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658417425; cv=none; d=google.com; s=arc-20160816; b=mF8YCX4QGa9/wHj0gh/vauQDoEAVkDz8aehYcouOMPGVUsX502GkcrVYVyVdRT+pSk UBpwtWajhQWFE9h2AWsOgQRCYytz52QOKLSn7r3tc/vYXC0kUP+I/JuFh4eThqzacIXF p+rG8RPlhukvKlCCGOl/6iWGcE2XTgYPObJWDCU8jPj/GPRkiGqW5bdbj6ScvDhP4sWG qw+nPPERjkq+myEgennFixj8dLyCkEwV8BK4FeHZDhnf0tqtKYOtVIprwewhvcUm7Soq 3FrJhAvr3c9V+skaXjg8UhsRl+4hchdUvQjxgXdj+vUZDl983r/KcdtdGyYvKqbq0xv9 zT1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=jKlUPO/ApCQ0j3fR2wl2bwsdIRBqhSKrUCSc9zR+enc=; b=lGT5AB8elHXiFUugj1TNczkjlqPdL9ggZYYFIpveRGqyIc4KHK6EsTGxbdh1ZoST15 X9wGjOfvswCi+OFbV8rXj7jD/oKzNjL3I8CxwUSBOpEI53fCklE5SgVXv4FZwQRH1LUS cAHaxi0Uu0i/EH5j66mwY7j2syXZfqrRnup2TMJzlelrgrQNK9Ey0or5CbcNidd88hQn 2z693Co3T1SPSuJkKycpivMU7rqHqRL2kiPKTaCVTS3oNnD0GTH813LgN18XPKcg1256 iI1ziyJFico6d0atoi5xlZEv+DgGBo0Vc35JdnMqBGjkaCb1+DCN+ZEf7rqr6kYH0K+6 HLDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y21-20020aa78f35000000b0051c28de280fsi2615690pfr.346.2022.07.21.08.30.09; Thu, 21 Jul 2022 08:30:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232302AbiGUOzR (ORCPT + 99 others); Thu, 21 Jul 2022 10:55:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231857AbiGUOzH (ORCPT ); Thu, 21 Jul 2022 10:55:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 078BB2ED41; Thu, 21 Jul 2022 07:55:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A53B1B82555; Thu, 21 Jul 2022 14:55:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0A4CC3411E; Thu, 21 Jul 2022 14:54:58 +0000 (UTC) Date: Thu, 21 Jul 2022 10:54:56 -0400 From: Steven Rostedt To: Tao Zhou Cc: Daniel Bristot de Oliveira , Wim Van Sebroeck , Guenter Roeck , Jonathan Corbet , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Will Deacon , Catalin Marinas , Marco Elver , Dmitry Vyukov , "Paul E. McKenney" , Shuah Khan , Gabriele Paoloni , Juri Lelli , Clark Williams , Randy Dunlap , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org Subject: Re: [PATCH V6 01/16] rv: Add Runtime Verification (RV) interface Message-ID: <20220721105456.1a6a8fb7@gandalf.local.home> In-Reply-To: References: <69bb4c369b4f6f12014eb9ca3c28b74e4378c007.1658244826.git.bristot@kernel.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 Jul 2022 22:38:25 +0800 Tao Zhou wrote: > > +static int enable_monitor(struct rv_monitor_def *mdef) > > +{ > > + int retval; > > + > > + if (!mdef->monitor->enabled) { > > + retval = mdef->monitor->enable(); > > + if (retval) > > + return retval; > > + } > > + > > + mdef->monitor->enabled = 1; > > This should be placed at the end of the last if block. Otherwise > another assignment may be duplicated because it is already 1 now. > no?(not sure how compiler treat this..) It really doesn't matter, it will just sent enabled to one even though it's already one. You could simplify this to be: static int enable_monitor(struct rv_monitor_def *mdef) { int retval; if (mdef->monitor->enabled) return 0; retval = mdef->monitor->enable(); if (!retval) mdef->monitor->enabled = 1; return retval; } -- Steve