From: Fabio Estevam <festevam@gmail.com>
To: m.chehab@samsung.com
Cc: p.zabel@pengutronix.de, linux-media@vger.kernel.org,
Fabio Estevam <fabio.estevam@freescale.com>
Subject: [PATCH 1/3] [media] coda: Call v4l2_device_unregister() from a single location
Date: Sat, 4 Oct 2014 16:40:50 -0300 [thread overview]
Message-ID: <1412451652-27220-1-git-send-email-festevam@gmail.com> (raw)
From: Fabio Estevam <fabio.estevam@freescale.com>
Instead of calling v4l2_device_unregister() in multiple locations within the
error paths, let's call it from a single location to make the error handling
simpler.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/media/platform/coda/coda-common.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index ced4760..7cd82e8 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1926,8 +1926,8 @@ static int coda_probe(struct platform_device *pdev)
} else if (pdev_id) {
dev->devtype = &coda_devdata[pdev_id->driver_data];
} else {
- v4l2_device_unregister(&dev->v4l2_dev);
- return -EINVAL;
+ ret = -EINVAL;
+ goto err_v4l2_register;
}
dev->debugfs_root = debugfs_create_dir("coda", NULL);
@@ -1941,8 +1941,7 @@ static int coda_probe(struct platform_device *pdev)
dev->debugfs_root);
if (ret < 0) {
dev_err(&pdev->dev, "failed to allocate work buffer\n");
- v4l2_device_unregister(&dev->v4l2_dev);
- return ret;
+ goto err_v4l2_register;
}
}
@@ -1952,8 +1951,7 @@ static int coda_probe(struct platform_device *pdev)
dev->debugfs_root);
if (ret < 0) {
dev_err(&pdev->dev, "failed to allocate temp buffer\n");
- v4l2_device_unregister(&dev->v4l2_dev);
- return ret;
+ goto err_v4l2_register;
}
}
@@ -1988,6 +1986,10 @@ static int coda_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
return coda_firmware_request(dev);
+
+err_v4l2_register:
+ v4l2_device_unregister(&dev->v4l2_dev);
+ return ret;
}
static int coda_remove(struct platform_device *pdev)
--
1.9.1
next reply other threads:[~2014-10-04 19:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-04 19:40 Fabio Estevam [this message]
2014-10-04 19:40 ` [PATCH 2/3] [media] coda: Unregister v4l2 upon alloc_workqueue() error Fabio Estevam
2014-10-05 7:33 ` Philipp Zabel
2014-10-04 19:40 ` [PATCH 3/3] [media] coda: Remove devm_kzalloc() error message Fabio Estevam
2014-10-05 7:37 ` Philipp Zabel
2014-10-05 7:32 ` [PATCH 1/3] [media] coda: Call v4l2_device_unregister() from a single location Philipp Zabel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1412451652-27220-1-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=fabio.estevam@freescale.com \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
--cc=p.zabel@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.