[2/3,media] coda: Unregister v4l2 upon alloc_workqueue() error

Message ID 1412451652-27220-2-git-send-email-festevam@gmail.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Fabio Estevam Oct. 4, 2014, 7:40 p.m. UTC
  From: Fabio Estevam <fabio.estevam@freescale.com>

If alloc_workqueue() fails, we should go to the 'err_v4l2_register' label, which
will unregister the v4l2 device.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/media/platform/coda/coda-common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Philipp Zabel Oct. 5, 2014, 7:33 a.m. UTC | #1
On Sat, Oct 04, 2014 at 04:40:51PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> If alloc_workqueue() fails, we should go to the 'err_v4l2_register' label, which
> will unregister the v4l2 device.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Acked-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 7cd82e8..951f1d4 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1971,7 +1971,8 @@  static int coda_probe(struct platform_device *pdev)
 	dev->workqueue = alloc_workqueue("coda", WQ_UNBOUND | WQ_MEM_RECLAIM, 1);
 	if (!dev->workqueue) {
 		dev_err(&pdev->dev, "unable to alloc workqueue\n");
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto err_v4l2_register;
 	}
 
 	platform_set_drvdata(pdev, dev);