usb: cdnsp: fix error return code in cdnsp_alloc_priv_device()
Subsystems (2)
PATCH 1/1 usb: cdnsp: fix error return code in cdnsp_alloc_priv_device()
If cdnsp_ring_alloc() fails, cdnsp_alloc_priv_device() need return error code.
Reported-by Hulk Robot <[email protected]>
Signed-off-by Yang Yingliang <[email protected]>
--- drivers/usb/cdns3/cdnsp-mem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/cdns3/cdnsp-mem.c +3 -1
@@ -694,8 +694,10 @@ static int cdnsp_alloc_priv_device(struct cdnsp_device *pdev)/* Allocate endpoint 0 ring. */ pdev->eps[0 ].ring =cdnsp_ring_alloc (pdev,2 ,TYPE_CTRL ,0 ,GFP_ATOMIC ); -if (!pdev->eps[0 ].ring) +if (!pdev->eps[0 ].ring) { + ret = -ENOMEM ; goto fail; + }/* Point to output device context in dcbaa. */ pdev->dcbaa->dev_context_ptrs[1 ] =cpu_to_le64 (pdev->out_ctx.dma);
Signature · 1 line
2.25.1
Quoted 7 lines
If
cdnsp_ring_alloc()fails,cdnsp_alloc_priv_device()need return error code.Reported-by Hulk Robot <[email protected]>Signed-off-by Yang Yingliang <[email protected]>
Acked-by Pawel Laszczak <[email protected]>
Thanks.
Quoted 21 lines
---
drivers/usb/cdns3/cdnsp-mem.c| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/usb/cdns3/cdnsp-mem.c +3
-2@@ -694,8 +694,10 @@ static int cdnsp_alloc_priv_device(struct cdnsp_device *pdev)/* Allocate endpoint 0 ring. */ pdev->eps[0 ].ring =cdnsp_ring_alloc (pdev,2 ,TYPE_CTRL ,0 ,GFP_ATOMIC ); -if (!pdev->eps[0 ].ring) +if (!pdev->eps[0 ].ring) { + ret = -ENOMEM ; goto fail; + }/* Point to output device context in dcbaa. */ pdev->dcbaa->dev_context_ptrs[1 ] =cpu_to_le64 (pdev->out_ctx.dma); --
Quoted 1 line
2.25.1
--
Regards,
Pawel Laszczak