Commit 35a1743f authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

xhci: dbc: Drop duplicate checks for dma_free_coherent()

dma_free_coherent() is NULL-aware, not necessary to check for
the parameter twice. Drop duplicate conditionals in the caller.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20231201150647.1307406-2-mathias.nyman@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 24af68a0
...@@ -28,7 +28,7 @@ static void dbc_ring_free(struct device *dev, struct xhci_ring *ring) ...@@ -28,7 +28,7 @@ static void dbc_ring_free(struct device *dev, struct xhci_ring *ring)
if (!ring) if (!ring)
return; return;
if (ring->first_seg && ring->first_seg->trbs) { if (ring->first_seg) {
dma_free_coherent(dev, TRB_SEGMENT_SIZE, dma_free_coherent(dev, TRB_SEGMENT_SIZE,
ring->first_seg->trbs, ring->first_seg->trbs,
ring->first_seg->dma); ring->first_seg->dma);
...@@ -394,9 +394,8 @@ static int dbc_erst_alloc(struct device *dev, struct xhci_ring *evt_ring, ...@@ -394,9 +394,8 @@ static int dbc_erst_alloc(struct device *dev, struct xhci_ring *evt_ring,
static void dbc_erst_free(struct device *dev, struct xhci_erst *erst) static void dbc_erst_free(struct device *dev, struct xhci_erst *erst)
{ {
if (erst->entries) dma_free_coherent(dev, sizeof(struct xhci_erst_entry), erst->entries,
dma_free_coherent(dev, sizeof(struct xhci_erst_entry), erst->erst_dma_addr);
erst->entries, erst->erst_dma_addr);
erst->entries = NULL; erst->entries = NULL;
} }
...@@ -543,11 +542,8 @@ static void xhci_dbc_mem_cleanup(struct xhci_dbc *dbc) ...@@ -543,11 +542,8 @@ static void xhci_dbc_mem_cleanup(struct xhci_dbc *dbc)
xhci_dbc_eps_exit(dbc); xhci_dbc_eps_exit(dbc);
if (dbc->string) { dma_free_coherent(dbc->dev, dbc->string_size, dbc->string, dbc->string_dma);
dma_free_coherent(dbc->dev, dbc->string_size,
dbc->string, dbc->string_dma);
dbc->string = NULL; dbc->string = NULL;
}
dbc_free_ctx(dbc->dev, dbc->ctx); dbc_free_ctx(dbc->dev, dbc->ctx);
dbc->ctx = NULL; dbc->ctx = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment