DORMANTno replies LANDED

Landed in mainline as 4ae08bc23e1b on 2021-05-11.

[PATCH v2] usb: cdnsp: Useless condition has been removed

From: Pawel Laszczak <pawell@cadence.com>
Date: 2021-05-05 05:59:30
Subsystem: cadence usbssp drd ip driver, the rest, usb subsystem · Maintainers: Pawel Laszczak, Linus Torvalds, Greg Kroah-Hartman

From: Pawel Laszczak <pawell@cadence.com>

This code generates a Smatch warning:

drivers/usb/cdns3/cdnsp-mem.c:1085 cdnsp_mem_cleanup()
warn: variable dereferenced before check 'pdev->dcbaa' (see line 1067)

The unchecked dereference happens inside the function when we call:

cdnsp_free_priv_device(pdev);

But fortunately, the "pdev->dcbaa" pointer can never be NULL so it
does not lead to a runtime issue. We can just remove the NULL check
which silences the warning and makes the code consistent.

Reported-by: kernel test robot <redacted>
Reported-by: Dan Carpenter <redacted>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>

---
Changelog:
v2:
- updated commit message

 drivers/usb/cdns3/cdnsp-mem.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/cdns3/cdnsp-mem.c b/drivers/usb/cdns3/cdnsp-mem.c
index 5d4c4bfe15b7..a47948a1623f 100644
--- a/drivers/usb/cdns3/cdnsp-mem.c
+++ b/drivers/usb/cdns3/cdnsp-mem.c
@@ -1082,9 +1082,8 @@ void cdnsp_mem_cleanup(struct cdnsp_device *pdev)
 	dma_pool_destroy(pdev->device_pool);
 	pdev->device_pool = NULL;
 
-	if (pdev->dcbaa)
-		dma_free_coherent(dev, sizeof(*pdev->dcbaa),
-				  pdev->dcbaa, pdev->dcbaa->dma);
+	dma_free_coherent(dev, sizeof(*pdev->dcbaa),
+			  pdev->dcbaa, pdev->dcbaa->dma);
 
 	pdev->dcbaa = NULL;
 
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help