Skip to contentSkip to conversation

usb: cdnsp: fix error return code in cdnsp_alloc_priv_device()

PATCH In review Yang Yingliang 2 participants 2 messages Jun 17, 2021 – Jun 18, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

---
 drivers/usb/cdns3/cdnsp-mem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/cdns3/cdnsp-mem.c +3 -1
index a47948a1623f..c87bf3513844 100644
@@ -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
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines

If cdnsp_ring_alloc() fails, cdnsp_alloc_priv_device() need return error code.

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
index a47948a1623f..c87bf3513844 100644
@@ -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