Thread (60 messages) 60 messages, 5 authors, 2025-09-04

Re: [RFC PATCH 01/17] rv: Refactor da_monitor to minimise macros

From: Nam Cao <hidden>
Date: 2025-08-25 08:03:59
Also in: lkml

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:
quoted
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.
quoted
quoted
+/*
+ * 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help