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

Message ID CAPgLHd_RFb8soKV_ceoozB4ms2tGY+o-m6j+Z9ES38NnrhgU7Q@mail.gmail.com (mailing list archive)
State Changes Requested, archived
Headers

Commit Message

Wei Yongjun May 13, 2013, 5:59 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>
---
 drivers/media/platform/blackfin/bfin_capture.c | 2 ++
 1 file changed, 2 insertions(+)


--
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, 7:40 a.m. UTC | #1
Hi Wei Yongjun,

>  drivers/media/platform/blackfin/bfin_capture.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c
> index 0e55b08..2d1e032 100644
> --- a/drivers/media/platform/blackfin/bfin_capture.c
> +++ b/drivers/media/platform/blackfin/bfin_capture.c
> @@ -1070,6 +1070,7 @@ static int bcap_probe(struct platform_device *pdev)
>                 if (!config->num_inputs) {
>                         v4l2_err(&bcap_dev->v4l2_dev,
>                                         "Unable to work without input\n");
> +                       ret = -EINVAL;
>                         goto err_unreg_vdev;
>                 }
>
It's better to move this check to  the beginning of this function as I
did in my bfin_display patch.

Scott
--
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/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c
index 0e55b08..2d1e032 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -1070,6 +1070,7 @@  static int bcap_probe(struct platform_device *pdev)
 		if (!config->num_inputs) {
 			v4l2_err(&bcap_dev->v4l2_dev,
 					"Unable to work without input\n");
+			ret = -EINVAL;
 			goto err_unreg_vdev;
 		}
 
@@ -1079,6 +1080,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;
 	}