Alexey Budankov <alexey.budan...@linux.intel.com> writes: >>> +static void >>> +perf_event_groups_insert(struct perf_event_groups *groups, >>> + struct perf_event *event) >>> +{ >>> + struct rb_node **node; >>> + struct rb_node *parent; >>> + struct perf_event *node_event; >>> + >>> + WARN_ON_ONCE(!groups || !event); >> >> I'm pretty sure neither of these is plausible. > > Used that for debugging.
It's a bad practice to keep leftovers of debugging code in the patches. In this particular case, as with most WARN*s that I've seen in this patchset, it is completely useless, because the code goes ahead and dereferences the pointers right after the assert, so there'd be an oops and we'd see it anyway. Normally, you'd use these assertions if you're actually handling the undesired scenario, like /* Can't happen because XXX */ if (WARN_ON_ONCE(!groups)) return -EINVAL; Also a comment justifying the WARN* is a good thing to have. > Does it affect performance somehow? It doesn't matter. Generally, we don't need an reason to remove code, we need a reason to add code. Regards, -- Alex