On Thu, Aug 21, 2025 at 10:49:05AM +0200, Gabriele Monaco wrote:
> On Thu, 2025-08-21 at 10:14 +0200, Nam Cao wrote:
> > On Thu, Aug 14, 2025 at 05:07:53PM +0200, Gabriele Monaco wrote:
> I think the reason was mostly laziness / wish to change less things.

Laziness is contagious, maybe you got it from me.

> > > +/*
> > > + * model_get_state_name - return the (string) name of the given
> > > state
> > > + */
> > > +static char *model_get_state_name(enum states state)
> > > +{
> > > + if ((state < 0) || (state >= STATE_MAX))
> > > +         return "INVALID";
> >
> > Just notice that this probably should be
> >     if (BUG_ON((state < 0) || (state >= STATE_MAX)))
> >
> > You shouldn't do it in this patch of course. I just want to note it
> > down.
> 
> Mmh, I'm not quite sure about this one, sure it's not a good thing when
> we try to get an invalid state/event, but isn't BUG a bit too much here?
> We're handling things gracefully so the kernel is not broken (although
> rv likely is).
> 
> If you really think we should note that, what about just WARN/WARN_ONCE ?

I think that if RV is run, then the system is just being tested, and
therefore it is not a big problem if the kernel crashes.

But WARN_ONCE is fine too.

Nam

Reply via email to