Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1303793 > unrolled thread

[PATCH 0/8] [media] Check v4l2_of_parse_endpoint() ret val in all drivers

Started byJavier Martinez Canillas <javier@osg.samsung.com>
First post2016-01-07 19:30 +0100
Last post2016-01-11 17:50 +0100
Articles 7 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/8] [media] Check v4l2_of_parse_endpoint() ret val in all drivers Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-07 19:30 +0100
    [PATCH 5/8] [media] tvp514x: Check v4l2_of_parse_endpoint() return value Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-07 19:30 +0100
      Re: [PATCH 5/8] [media] tvp514x: Check v4l2_of_parse_endpoint()  return value Sakari Ailus <sakari.ailus@iki.fi> - 2016-01-10 00:10 +0100
    [PATCH 6/8] [media] tvp7002: Check v4l2_of_parse_endpoint() return value Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-07 19:40 +0100
      Re: [PATCH 6/8] [media] tvp7002: Check v4l2_of_parse_endpoint()  return value Sakari Ailus <sakari.ailus@iki.fi> - 2016-01-10 00:10 +0100
    Re: [PATCH 0/8] [media] Check v4l2_of_parse_endpoint() ret val in  all drivers Sakari Ailus <sakari.ailus@iki.fi> - 2016-01-10 00:10 +0100
      Re: [PATCH 0/8] [media] Check v4l2_of_parse_endpoint() ret val in all  drivers Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-11 17:50 +0100

#1303793 — [PATCH 0/8] [media] Check v4l2_of_parse_endpoint() ret val in all drivers

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-01-07 19:30 +0100
Subject[PATCH 0/8] [media] Check v4l2_of_parse_endpoint() ret val in all drivers
Message-ID<qOntU-3ug-3@gated-at.bofh.it>
Hello,

When discussing a patch [0] with Laurent Pinchart for another series I
mentioned to him that most callers of v4l2_of_parse_endpoint() weren't
checking the return value. This is likely due the function kernel-doc
stating incorrectly that the return value is always 0 but can return a
negative error code on failure.

This trivial patch series fixes the function kernel-doc and add proper
error checking in all the drivers that are currently not doing so.

[0]: https://lkml.org/lkml/2016/1/6/307

Best regards,
Javier


Javier Martinez Canillas (8):
  [media] v4l: of: Correct v4l2_of_parse_endpoint() kernel-doc
  [media] adv7604: Check v4l2_of_parse_endpoint() return value
  [media] s5c73m3: Check v4l2_of_parse_endpoint() return value
  [media] s5k5baf: Check v4l2_of_parse_endpoint() return value
  [media] tvp514x: Check v4l2_of_parse_endpoint() return value
  [media] tvp7002: Check v4l2_of_parse_endpoint() return value
  [media] exynos4-is: Check v4l2_of_parse_endpoint() return value
  [media] omap3isp: Check v4l2_of_parse_endpoint() return value

 drivers/media/i2c/adv7604.c                   |  7 ++++++-
 drivers/media/i2c/s5c73m3/s5c73m3-core.c      |  4 +++-
 drivers/media/i2c/s5k5baf.c                   |  5 ++++-
 drivers/media/i2c/tvp514x.c                   |  4 +++-
 drivers/media/i2c/tvp7002.c                   |  4 +++-
 drivers/media/platform/exynos4-is/media-dev.c |  8 +++++++-
 drivers/media/platform/exynos4-is/mipi-csis.c | 10 +++++++---
 drivers/media/platform/omap3isp/isp.c         |  5 ++++-
 drivers/media/v4l2-core/v4l2-of.c             |  2 +-
 9 files changed, 38 insertions(+), 11 deletions(-)

-- 
2.4.3

[toc] | [next] | [standalone]


#1303794 — [PATCH 5/8] [media] tvp514x: Check v4l2_of_parse_endpoint() return value

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-01-07 19:30 +0100
Subject[PATCH 5/8] [media] tvp514x: Check v4l2_of_parse_endpoint() return value
Message-ID<qOntW-3ug-59@gated-at.bofh.it>
In reply to#1303793
The v4l2_of_parse_endpoint() function can fail so check the return value.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/media/i2c/tvp514x.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index 7fa5f1e4fe37..7a1e20feade9 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -1013,11 +1013,13 @@ tvp514x_get_pdata(struct i2c_client *client)
 	if (!endpoint)
 		return NULL;
 
+	if (v4l2_of_parse_endpoint(endpoint, &bus_cfg))
+		goto done;
+
 	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
 	if (!pdata)
 		goto done;
 
-	v4l2_of_parse_endpoint(endpoint, &bus_cfg);
 	flags = bus_cfg.bus.parallel.flags;
 
 	if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.4.3

[toc] | [prev] | [next] | [standalone]


#1305386 — Re: [PATCH 5/8] [media] tvp514x: Check v4l2_of_parse_endpoint() return value

FromSakari Ailus <sakari.ailus@iki.fi>
Date2016-01-10 00:10 +0100
SubjectRe: [PATCH 5/8] [media] tvp514x: Check v4l2_of_parse_endpoint() return value
Message-ID<qPaNY-41a-5@gated-at.bofh.it>
In reply to#1303794
On Thu, Jan 07, 2016 at 03:27:19PM -0300, Javier Martinez Canillas wrote:
> The v4l2_of_parse_endpoint() function can fail so check the return value.
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> ---
> 
>  drivers/media/i2c/tvp514x.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
> index 7fa5f1e4fe37..7a1e20feade9 100644
> --- a/drivers/media/i2c/tvp514x.c
> +++ b/drivers/media/i2c/tvp514x.c
> @@ -1013,11 +1013,13 @@ tvp514x_get_pdata(struct i2c_client *client)
>  	if (!endpoint)
>  		return NULL;
>  
> +	if (v4l2_of_parse_endpoint(endpoint, &bus_cfg))

Same as in patch 6.

> +		goto done;
> +
>  	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
>  	if (!pdata)
>  		goto done;
>  
> -	v4l2_of_parse_endpoint(endpoint, &bus_cfg);
>  	flags = bus_cfg.bus.parallel.flags;
>  
>  	if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)

-- 
Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

[toc] | [prev] | [next] | [standalone]


#1303797 — [PATCH 6/8] [media] tvp7002: Check v4l2_of_parse_endpoint() return value

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-01-07 19:40 +0100
Subject[PATCH 6/8] [media] tvp7002: Check v4l2_of_parse_endpoint() return value
Message-ID<qOnDA-3xV-23@gated-at.bofh.it>
In reply to#1303793
The v4l2_of_parse_endpoint() function can fail so check the return value.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/media/i2c/tvp7002.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 83c79fa5f61d..4aac303da5d4 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -905,11 +905,13 @@ tvp7002_get_pdata(struct i2c_client *client)
 	if (!endpoint)
 		return NULL;
 
+	if (v4l2_of_parse_endpoint(endpoint, &bus_cfg))
+		goto done;
+
 	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
 	if (!pdata)
 		goto done;
 
-	v4l2_of_parse_endpoint(endpoint, &bus_cfg);
 	flags = bus_cfg.bus.parallel.flags;
 
 	if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.4.3

[toc] | [prev] | [next] | [standalone]


#1305384 — Re: [PATCH 6/8] [media] tvp7002: Check v4l2_of_parse_endpoint() return value

FromSakari Ailus <sakari.ailus@iki.fi>
Date2016-01-10 00:10 +0100
SubjectRe: [PATCH 6/8] [media] tvp7002: Check v4l2_of_parse_endpoint() return value
Message-ID<qPaNX-41a-3@gated-at.bofh.it>
In reply to#1303797
Hi Javier,

On Thu, Jan 07, 2016 at 03:27:20PM -0300, Javier Martinez Canillas wrote:
> The v4l2_of_parse_endpoint() function can fail so check the return value.
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> ---
> 
>  drivers/media/i2c/tvp7002.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
> index 83c79fa5f61d..4aac303da5d4 100644
> --- a/drivers/media/i2c/tvp7002.c
> +++ b/drivers/media/i2c/tvp7002.c
> @@ -905,11 +905,13 @@ tvp7002_get_pdata(struct i2c_client *client)
>  	if (!endpoint)
>  		return NULL;
>  
> +	if (v4l2_of_parse_endpoint(endpoint, &bus_cfg))

pdata is uninitialised here. There are many ways to fix this but I think I'd
just assign it to NULL in variable declaration.

> +		goto done;
> +
>  	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
>  	if (!pdata)
>  		goto done;
>  
> -	v4l2_of_parse_endpoint(endpoint, &bus_cfg);
>  	flags = bus_cfg.bus.parallel.flags;
>  
>  	if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

[toc] | [prev] | [next] | [standalone]


#1305389 — Re: [PATCH 0/8] [media] Check v4l2_of_parse_endpoint() ret val in all drivers

FromSakari Ailus <sakari.ailus@iki.fi>
Date2016-01-10 00:10 +0100
SubjectRe: [PATCH 0/8] [media] Check v4l2_of_parse_endpoint() ret val in all drivers
Message-ID<qPaNY-41a-21@gated-at.bofh.it>
In reply to#1303793
Hi Javier,

On Thu, Jan 07, 2016 at 03:27:14PM -0300, Javier Martinez Canillas wrote:
> Hello,
> 
> When discussing a patch [0] with Laurent Pinchart for another series I
> mentioned to him that most callers of v4l2_of_parse_endpoint() weren't
> checking the return value. This is likely due the function kernel-doc
> stating incorrectly that the return value is always 0 but can return a
> negative error code on failure.
> 
> This trivial patch series fixes the function kernel-doc and add proper
> error checking in all the drivers that are currently not doing so.

After fixing patches 5 and 6,

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

[toc] | [prev] | [next] | [standalone]


#1306504 — Re: [PATCH 0/8] [media] Check v4l2_of_parse_endpoint() ret val in all drivers

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-01-11 17:50 +0100
SubjectRe: [PATCH 0/8] [media] Check v4l2_of_parse_endpoint() ret val in all drivers
Message-ID<qPNPm-4ZY-51@gated-at.bofh.it>
In reply to#1305389
Hello Sakari,

On 01/09/2016 08:03 PM, Sakari Ailus wrote:
> Hi Javier,
> 
> On Thu, Jan 07, 2016 at 03:27:14PM -0300, Javier Martinez Canillas wrote:
>> Hello,
>>
>> When discussing a patch [0] with Laurent Pinchart for another series I
>> mentioned to him that most callers of v4l2_of_parse_endpoint() weren't
>> checking the return value. This is likely due the function kernel-doc
>> stating incorrectly that the return value is always 0 but can return a
>> negative error code on failure.
>>
>> This trivial patch series fixes the function kernel-doc and add proper
>> error checking in all the drivers that are currently not doing so.
> 
> After fixing patches 5 and 6,
> 

Done, posted a v2 fixing the issues you pointed out.

> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> 

Thanks a lot for your feedback and review!

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web