Commit 4ae08bc2 authored by Pawel Laszczak's avatar Pawel Laszczak Committed by Peter Chen

usb: cdnsp: Useless condition has been removed

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: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarPawel Laszczak <pawell@cadence.com>
Link: https://lore.kernel.org/r/20210505055854.40240-1-pawell@gli-login.cadence.comSigned-off-by: default avatarPeter Chen <peter.chen@kernel.org>
parent 440e547d
......@@ -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;
......
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