linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] usb: cdnsp: fix error return code in cdnsp_alloc_priv_device()
@ 2021-06-17 14:31 Yang Yingliang
  2021-06-18  4:14 ` Pawel Laszczak
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-06-17 14:31 UTC (permalink / raw)
  To: linux-kernel, linux-usb; +Cc: pawell, gregkh

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

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/usb/cdns3/cdnsp-mem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/cdns3/cdnsp-mem.c b/drivers/usb/cdns3/cdnsp-mem.c
index a47948a1623f..c87bf3513844 100644
--- a/drivers/usb/cdns3/cdnsp-mem.c
+++ b/drivers/usb/cdns3/cdnsp-mem.c
@@ -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);
-- 
2.25.1


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

* RE: [PATCH -next] usb: cdnsp: fix error return code in cdnsp_alloc_priv_device()
  2021-06-17 14:31 [PATCH -next] usb: cdnsp: fix error return code in cdnsp_alloc_priv_device() Yang Yingliang
@ 2021-06-18  4:14 ` Pawel Laszczak
  0 siblings, 0 replies; 2+ messages in thread
From: Pawel Laszczak @ 2021-06-18  4:14 UTC (permalink / raw)
  To: Yang Yingliang, linux-kernel, linux-usb; +Cc: gregkh


>
>If cdnsp_ring_alloc() fails, cdnsp_alloc_priv_device() need return
>error code.
>
>Reported-by: Hulk Robot <hulkci@huawei.com>
>Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Acked-by: Pawel Laszczak <pawell@cadence.com>

Thanks.

>---
> drivers/usb/cdns3/cdnsp-mem.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/usb/cdns3/cdnsp-mem.c b/drivers/usb/cdns3/cdnsp-mem.c
>index a47948a1623f..c87bf3513844 100644
>--- a/drivers/usb/cdns3/cdnsp-mem.c
>+++ b/drivers/usb/cdns3/cdnsp-mem.c
>@@ -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);
>--
>2.25.1

--

Regards,
Pawel Laszczak

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

end of thread, other threads:[~2021-06-18  4:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 14:31 [PATCH -next] usb: cdnsp: fix error return code in cdnsp_alloc_priv_device() Yang Yingliang
2021-06-18  4:14 ` Pawel Laszczak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).