25 Jul
2023
25 Jul
'23
noon
On 25.07.23 04:33, Wesley Cheng wrote:
Hi,
this is more of a stylistic remark, but this:
[..]
- /* Find available secondary interrupter, interrupter 0 is reserverd for primary */
- for (i = 1; i < xhci->max_interrupters; i++) {
if (xhci->interrupters[i] == NULL) {
err = xhci_add_interrupter(xhci, ir, i);
break;
}
- }
- spin_unlock_irq(&xhci->lock);
- if (!err) {
Making the non error case a conditional return is ...
xhci_dbg(xhci, "Add secondary interrupter %d, max interrupters %d\n",
i, xhci->max_interrupters);
return ir;
- }
- xhci_warn(xhci, "Failed to add secondary interrupter, max interrupters %d\n",
xhci->max_interrupters);
- xhci_free_interrupter(xhci, ir);
- return NULL;
+}
Was this taken out of a style guide that teaches to avoid "goto" at any cost?
Regards Oliver