On Fri, 23 May 2025, David Laight wrote:
On Wed, 21 May 2025 16:27:04 +0100 Lee Jones lee@kernel.org wrote:
From: Kuniyuki Iwashima kuniyu@amazon.com
[ Upstream commit d0f6dc26346863e1f4a23117f5468614e54df064 ]
This is a prep patch for the last patch in this series so that checkpatch will not warn about BUG_ON().
Does any of this actually make any sense? Either the BUG_ON() should be just deleted because it can't happen (or doesn't matter) or there should be an error path. Blindly replacing with WARN_ON_ONCE() can't be right.
The last change (repeated here)
if (u) {
BUG_ON(!u->inflight);
BUG_ON(list_empty(&u->link));
WARN_ON_ONCE(!u->inflight);
WARN_ON_ONCE(list_empty(&u->link));
u->inflight--; if (!u->inflight)
is clearly just plain wrong. If 'inflight' is zero then 'decrementing' it to ~0 is just going to 'crash and burn' very badly not much later on.
All of this gets removed in patch 20, so I fear the point is moot.