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


Groups > linux.kernel > #1306507 > unrolled thread

[PATCH v2 5/8] [media] tvp514x: Check v4l2_of_parse_endpoint() return value

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

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 5/8] [media] tvp514x: Check v4l2_of_parse_endpoint() return value Javier Martinez Canillas <javier@osg.samsung.com> - 2016-01-11 17:50 +0100
    Re: [PATCH v2 5/8] [media] tvp514x: Check v4l2_of_parse_endpoint()  return value "Lad, Prabhakar" <prabhakar.csengg@gmail.com> - 2016-01-13 11:50 +0100

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

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-01-11 17:50 +0100
Subject[PATCH v2 5/8] [media] tvp514x: Check v4l2_of_parse_endpoint() return value
Message-ID<qPNPm-4ZY-49@gated-at.bofh.it>
The v4l2_of_parse_endpoint() function can fail so check the return value.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

---

Changes in v2:
- Assign pdata to NULL in case v4l2_of_parse_endpoint() fails before kzalloc.
  Suggested by Sakari Ailus.

 drivers/media/i2c/tvp514x.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index 7fa5f1e4fe37..7cdd94842938 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -1001,7 +1001,7 @@ static struct tvp514x_decoder tvp514x_dev = {
 static struct tvp514x_platform_data *
 tvp514x_get_pdata(struct i2c_client *client)
 {
-	struct tvp514x_platform_data *pdata;
+	struct tvp514x_platform_data *pdata = NULL;
 	struct v4l2_of_endpoint bus_cfg;
 	struct device_node *endpoint;
 	unsigned int flags;
@@ -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] | [next] | [standalone]


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

From"Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Date2016-01-13 11:50 +0100
SubjectRe: [PATCH v2 5/8] [media] tvp514x: Check v4l2_of_parse_endpoint() return value
Message-ID<qQra2-6Tj-21@gated-at.bofh.it>
In reply to#1306507
On Mon, Jan 11, 2016 at 4:47 PM, Javier Martinez Canillas
<javier@osg.samsung.com> wrote:
> The v4l2_of_parse_endpoint() function can fail so check the return value.
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

Regards,
--Prabhakar Lad

> ---
>
> Changes in v2:
> - Assign pdata to NULL in case v4l2_of_parse_endpoint() fails before kzalloc.
>   Suggested by Sakari Ailus.
>
>  drivers/media/i2c/tvp514x.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
> index 7fa5f1e4fe37..7cdd94842938 100644
> --- a/drivers/media/i2c/tvp514x.c
> +++ b/drivers/media/i2c/tvp514x.c
> @@ -1001,7 +1001,7 @@ static struct tvp514x_decoder tvp514x_dev = {
>  static struct tvp514x_platform_data *
>  tvp514x_get_pdata(struct i2c_client *client)
>  {
> -       struct tvp514x_platform_data *pdata;
> +       struct tvp514x_platform_data *pdata = NULL;
>         struct v4l2_of_endpoint bus_cfg;
>         struct device_node *endpoint;
>         unsigned int flags;
> @@ -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] | [standalone]


Back to top | Article view | linux.kernel


csiph-web