diff mbox

[v2,media] blackfin: fix error return code in bcap_probe()

Message ID CAPgLHd92D618-a7H7=wjo1W=5JqYvPR4kSga3UcqW84n=n0POg@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Yongjun May 13, 2013, 8:52 a.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
v1 -> v2: move config->num_inputs check to the beginning of this function
---
 drivers/media/platform/blackfin/bfin_capture.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)


--
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

Comments

Scott Jiang May 13, 2013, 9:38 a.m. UTC | #1
2013/5/13 Wei Yongjun <weiyj.lk@gmail.com>:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> v1 -> v2: move config->num_inputs check to the beginning of this function
> ---
>  drivers/media/platform/blackfin/bfin_capture.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c
> index 0e55b08..391d9a9 100644
> --- a/drivers/media/platform/blackfin/bfin_capture.c
> +++ b/drivers/media/platform/blackfin/bfin_capture.c
> @@ -960,7 +960,7 @@ static int bcap_probe(struct platform_device *pdev)
>         int ret;
>
>         config = pdev->dev.platform_data;
> -       if (!config) {
> +       if (!config || !config->num_inputs) {
>                 v4l2_err(pdev->dev.driver, "Unable to get board config\n");
>                 return -ENODEV;
>         }
> @@ -1067,11 +1067,6 @@ static int bcap_probe(struct platform_device *pdev)
>                                                  NULL);
>         if (bcap_dev->sd) {
>                 int i;
> -               if (!config->num_inputs) {
> -                       v4l2_err(&bcap_dev->v4l2_dev,
> -                                       "Unable to work without input\n");
> -                       goto err_unreg_vdev;
> -               }
>
>                 /* update tvnorms from the sub devices */
>                 for (i = 0; i < config->num_inputs; i++)
> @@ -1079,6 +1074,7 @@ static int bcap_probe(struct platform_device *pdev)
>         } else {
>                 v4l2_err(&bcap_dev->v4l2_dev,
>                                 "Unable to register sub device\n");
> +               ret = -ENODEV;
>                 goto err_unreg_vdev;
>         }
>
>

Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
--
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
diff mbox

Patch

diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c
index 0e55b08..391d9a9 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -960,7 +960,7 @@  static int bcap_probe(struct platform_device *pdev)
 	int ret;
 
 	config = pdev->dev.platform_data;
-	if (!config) {
+	if (!config || !config->num_inputs) {
 		v4l2_err(pdev->dev.driver, "Unable to get board config\n");
 		return -ENODEV;
 	}
@@ -1067,11 +1067,6 @@  static int bcap_probe(struct platform_device *pdev)
 						 NULL);
 	if (bcap_dev->sd) {
 		int i;
-		if (!config->num_inputs) {
-			v4l2_err(&bcap_dev->v4l2_dev,
-					"Unable to work without input\n");
-			goto err_unreg_vdev;
-		}
 
 		/* update tvnorms from the sub devices */
 		for (i = 0; i < config->num_inputs; i++)
@@ -1079,6 +1074,7 @@  static int bcap_probe(struct platform_device *pdev)
 	} else {
 		v4l2_err(&bcap_dev->v4l2_dev,
 				"Unable to register sub device\n");
+		ret = -ENODEV;
 		goto err_unreg_vdev;
 	}