Re: [PATCH V6 01/16] rv: Add Runtime Verification (RV) interface
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [PATCH V6 01/16] rv: Add Runtime Verification (RV) interface
- From: Steven Rostedt <rostedt@xxxxxxxxxxx>
- Date: Thu, 21 Jul 2022 10:54:56 -0400
- Cc: Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>, Wim Van Sebroeck <wim@xxxxxxxxxxxxxxxxxx>, Guenter Roeck <linux@xxxxxxxxxxxx>, Jonathan Corbet <corbet@xxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Will Deacon <will@xxxxxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Marco Elver <elver@xxxxxxxxxx>, Dmitry Vyukov <dvyukov@xxxxxxxxxx>, "Paul E. McKenney" <paulmck@xxxxxxxxxx>, Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>, Gabriele Paoloni <gpaoloni@xxxxxxxxxx>, Juri Lelli <juri.lelli@xxxxxxxxxx>, Clark Williams <williams@xxxxxxxxxx>, Randy Dunlap <rdunlap@xxxxxxxxxxxxx>, linux-doc@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-trace-devel@xxxxxxxxxxxxxxx
- In-reply-to: <Ytlk4ePA+TpGItJ6@geo.homenetwork>
- References: <cover.1658244826.git.bristot@kernel.org> <69bb4c369b4f6f12014eb9ca3c28b74e4378c007.1658244826.git.bristot@kernel.org> <Ytlk4ePA+TpGItJ6@geo.homenetwork>
On Thu, 21 Jul 2022 22:38:25 +0800
Tao Zhou <tao.zhou@xxxxxxxxx> 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
[Index of Archives]
[Linux USB Development]
[Linux USB Development]
[Linux Audio Users]
[Yosemite Hiking]
[Linux Kernel]
[Linux SCSI]