public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 01/10] xhci: dbc: Drop duplicate checks for dma_free_coherent()
@ 2023-10-02 16:16 Andy Shevchenko
  2023-10-02 16:16 ` [PATCH v1 02/10] xhci: dbc: Convert to use sysfs_streq() Andy Shevchenko
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Andy Shevchenko @ 2023-10-02 16:16 UTC (permalink / raw)
  To: Andy Shevchenko, Mathias Nyman, linux-usb, linux-kernel
  Cc: Mathias Nyman, Greg Kroah-Hartman

dma_free_coherent() is NULL-aware, not necessary to check for
the parameter twice. Drop duplicate conditionals in the caller.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/usb/host/xhci-dbgcap.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
index b40d9238d447..9e9ce3711813 100644
--- a/drivers/usb/host/xhci-dbgcap.c
+++ b/drivers/usb/host/xhci-dbgcap.c
@@ -28,7 +28,7 @@ static void dbc_ring_free(struct device *dev, struct xhci_ring *ring)
 	if (!ring)
 		return;
 
-	if (ring->first_seg && ring->first_seg->trbs) {
+	if (ring->first_seg) {
 		dma_free_coherent(dev, TRB_SEGMENT_SIZE,
 				  ring->first_seg->trbs,
 				  ring->first_seg->dma);
@@ -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)
 {
-	if (erst->entries)
-		dma_free_coherent(dev, sizeof(struct xhci_erst_entry),
-				  erst->entries, erst->erst_dma_addr);
+	dma_free_coherent(dev, sizeof(struct xhci_erst_entry), erst->entries,
+			  erst->erst_dma_addr);
 	erst->entries = NULL;
 }
 
@@ -543,11 +542,8 @@ static void xhci_dbc_mem_cleanup(struct xhci_dbc *dbc)
 
 	xhci_dbc_eps_exit(dbc);
 
-	if (dbc->string) {
-		dma_free_coherent(dbc->dev, dbc->string_size,
-				  dbc->string, dbc->string_dma);
-		dbc->string = NULL;
-	}
+	dma_free_coherent(dbc->dev, dbc->string_size, dbc->string, dbc->string_dma);
+	dbc->string = NULL;
 
 	dbc_free_ctx(dbc->dev, dbc->ctx);
 	dbc->ctx = NULL;
-- 
2.40.0.1.gaa8946217a0b


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-10-11 14:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-02 16:16 [PATCH v1 01/10] xhci: dbc: Drop duplicate checks for dma_free_coherent() Andy Shevchenko
2023-10-02 16:16 ` [PATCH v1 02/10] xhci: dbc: Convert to use sysfs_streq() Andy Shevchenko
2023-10-02 16:16 ` [PATCH v1 03/10] xhci: dbc: Use sysfs_emit() to instead of scnprintf() Andy Shevchenko
2023-10-02 18:03   ` kernel test robot
2023-10-03  8:50     ` Andy Shevchenko
2023-10-03 12:30       ` Mathias Nyman
2023-10-02 16:16 ` [PATCH v1 04/10] xhci: dbc: Use ATTRIBUTE_GROUPS() Andy Shevchenko
2023-10-11 14:18   ` Mathias Nyman
2023-10-02 16:16 ` [PATCH v1 05/10] xhci: dbc: Check for errors first in xhci_dbc_stop() Andy Shevchenko
2023-10-02 16:16 ` [PATCH v1 06/10] xhci: dbc: Don't shadow error codes in store() functions Andy Shevchenko
2023-10-02 16:16 ` [PATCH v1 07/10] xhci: dbc: Replace custom return value with proper Linux error code Andy Shevchenko
2023-10-02 16:16 ` [PATCH v1 08/10] xhci: dbc: Use sizeof_field() where it makes sense Andy Shevchenko
2023-10-02 16:16 ` [PATCH v1 09/10] xhci: dbc: Use sizeof(*pointer) instead of sizeof(type) Andy Shevchenko
2023-10-02 16:16 ` [PATCH v1 10/10] xhci: dbc: Add missing headers Andy Shevchenko
2023-10-11 14:20   ` Mathias Nyman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox