Skip to contentSkip to conversation

maillbox: bcm-flexrm-mailbox: handle cmpl_pool dma allocation failure

PATCH Superseded Rayagonda Kokatanur 2 participants 3 messages Mar 17, 2020 – Mar 18, 2020 Mailbox API

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 maillbox: bcm-flexrm-mailbox: handle cmpl_pool dma allocation failure

Handle 'cmpl_pool' dma memory allocation failure.

---
 drivers/mailbox/bcm-flexrm-mailbox.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mailbox/bcm-flexrm-mailbox.c +2 -0
index 8ee9db274802..bee33abb5308 100644
@@ -1599,6 +1599,7 @@ static int flexrm_mbox_probe(struct platform_device *pdev)
 					  1 << RING_CMPL_ALIGN_ORDER, 0);
 	if (!mbox->cmpl_pool) {
 		ret = -ENOMEM;
+		goto fail_destroy_bd_pool;
 	}
 
 	/* Allocate platform MSIs for each ring */
@@ -1661,6 +1662,7 @@ static int flexrm_mbox_probe(struct platform_device *pdev)
 	platform_msi_domain_free_irqs(dev);
 fail_destroy_cmpl_pool:
 	dma_pool_destroy(mbox->cmpl_pool);
+fail_destroy_bd_pool:
 	dma_pool_destroy(mbox->bd_pool);
 fail:
 	return ret;
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Rayagonda Kokatanur

Handle 'cmpl_pool' dma memory allocation failure.

This looks correct to me.

It would be ideal if we could include this tag when applying the fix (or sending a v2):

Fixes a9a9da47f8e6 ("mailbox: no need to check return value of debugfs_create functions")

Thanks!

Tyler

Quoted 27 lines
---
 drivers/mailbox/bcm-flexrm-mailbox.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mailbox/bcm-flexrm-mailbox.c +2 -0
index 8ee9db274802..bee33abb5308 100644
@@ -1599,6 +1599,7 @@ static int flexrm_mbox_probe(struct platform_device *pdev)
 					  1 << RING_CMPL_ALIGN_ORDER, 0);
 	if (!mbox->cmpl_pool) {
 		ret = -ENOMEM;
+		goto fail_destroy_bd_pool;
 	}
 
 	/* Allocate platform MSIs for each ring */
@@ -1661,6 +1662,7 @@ static int flexrm_mbox_probe(struct platform_device *pdev)
 	platform_msi_domain_free_irqs(dev);
 fail_destroy_cmpl_pool:
 	dma_pool_destroy(mbox->cmpl_pool);
+fail_destroy_bd_pool:
 	dma_pool_destroy(mbox->bd_pool);
 fail:
 	return ret;
Signature · 1 line
2.17.1
#2 lore raw
Quoted 6 lines · Tyler Hicks
Quoted 3 lines · Rayagonda Kokatanur

Handle 'cmpl_pool' dma memory allocation failure.

Quoted 8 lines

This looks correct to me.

It would be ideal if we could include this tag when applying the fix (or sending a v2):

Fixes a9a9da47f8e6 ("mailbox: no need to check return value of debugfs_create functions")

Thank you, added missing Fixes tag and sent v2.

Quoted 32 lines

Thanks!

Tyler

Quoted 27 lines
---
 drivers/mailbox/bcm-flexrm-mailbox.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mailbox/bcm-flexrm-mailbox.c +2 -1
index 8ee9db274802..bee33abb5308 100644
@@ -1599,6 +1599,7 @@ static int flexrm_mbox_probe(struct platform_device *pdev)
                                        1 << RING_CMPL_ALIGN_ORDER, 0);
      if (!mbox->cmpl_pool) {
              ret = -ENOMEM;
+             goto fail_destroy_bd_pool;
      }
 
      /* Allocate platform MSIs for each ring */
@@ -1661,6 +1662,7 @@ static int flexrm_mbox_probe(struct platform_device *pdev)
      platform_msi_domain_free_irqs(dev);
 fail_destroy_cmpl_pool:
      dma_pool_destroy(mbox->cmpl_pool);
+fail_destroy_bd_pool:
      dma_pool_destroy(mbox->bd_pool);
 fail:
      return ret;
--

2.17.1