xhci: dbc: Check for errors first in xhci_dbc_stop()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 1 Dec 2023 15:06:33 +0000 (17:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Dec 2023 06:50:40 +0000 (07:50 +0100)
The usual pattern is to check for errors and then continue if none.
Apply that pattern to xhci_dbc_stop() code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20231201150647.1307406-6-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-dbgcap.c

index 660e3ee31dc69ff7ee48bf31b786323428d5bc45..6b9f4b839270956c0b913edb1e59c99047c265a0 100644 (file)
@@ -646,11 +646,11 @@ static void xhci_dbc_stop(struct xhci_dbc *dbc)
        spin_lock_irqsave(&dbc->lock, flags);
        ret = xhci_do_dbc_stop(dbc);
        spin_unlock_irqrestore(&dbc->lock, flags);
+       if (ret)
+               return;
 
-       if (!ret) {
-               xhci_dbc_mem_cleanup(dbc);
-               pm_runtime_put_sync(dbc->dev); /* note, was self.controller */
-       }
+       xhci_dbc_mem_cleanup(dbc);
+       pm_runtime_put_sync(dbc->dev); /* note, was self.controller */
 }
 
 static void