Checkpatch miscomplaint about multi-arm if-statement

From: David Howells
Date: Tue Dec 03 2024 - 13:23:34 EST


Hi,

I'm seeing this:

WARNING: else is not generally useful after a break or return
#1220: FILE: net/rxrpc/sendmsg.c:301:
+ return -ENOMEM;
+ } else {

on:

if (call->send_queue) {
tq->qbase = call->send_top + 1;
call->send_queue->next = tq;
call->send_queue = tq;
} else if (WARN_ON(call->tx_queue)) {
kfree(tq);
return -ENOMEM;
} else {
tq->qbase = 0;
call->tx_qbase = 0;
call->send_queue = tq;
call->tx_qtail = tq;
call->tx_queue = tq;
}

but you cannot eliminate the last 'else' statement there.

David