All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-media@vger.kernel.org,
	Sylwester Nawrocki <sylvester.nawrocki@gmail.com>,
	Mauro Carvalho Chehab <mchehab@s-opensource.com>
Subject: Re: [PATCH] media: ov9650: remove unnecessary terminated entry in menu items array
Date: Wed, 25 Oct 2017 13:23:07 +0300	[thread overview]
Message-ID: <20171025102307.qjvqtorri4lw3weo@valkosipuli.retiisi.org.uk> (raw)
In-Reply-To: <1508779826-12499-1-git-send-email-akinobu.mita@gmail.com>

On Tue, Oct 24, 2017 at 02:30:26AM +0900, Akinobu Mita wrote:
> The test_pattern_menu[] array has two valid items and a null terminated
> item.  So the control's maximum value which is passed to
> v4l2_ctrl_new_std_menu_items() should be one.  However,
> 'ARRAY_SIZE(test_pattern_menu) - 1' is actually passed and it's not
> correct.
> 
> Fix it by removing unnecessary terminated entry and let the correct
> control's maximum value be passed to v4l2_ctrl_new_std_menu_items().
> 
> Cc: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
> Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> ---
>  drivers/media/i2c/ov9650.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
> index 6ffb460..69433e1 100644
> --- a/drivers/media/i2c/ov9650.c
> +++ b/drivers/media/i2c/ov9650.c
> @@ -985,7 +985,6 @@ static const struct v4l2_ctrl_ops ov965x_ctrl_ops = {
>  static const char * const test_pattern_menu[] = {
>  	"Disabled",
>  	"Color bars",
> -	NULL

The number of items in the menu changes; I fixed that while applying the
patch:

diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
index 69433e1e2533..4f59da1f967b 100644
--- a/drivers/media/i2c/ov9650.c
+++ b/drivers/media/i2c/ov9650.c
@@ -1039,7 +1039,7 @@ static int ov965x_initialize_controls(struct ov965x *ov965x)
 				       V4L2_CID_POWER_LINE_FREQUENCY_50HZ);
 
 	v4l2_ctrl_new_std_menu_items(hdl, ops, V4L2_CID_TEST_PATTERN,
-				     ARRAY_SIZE(test_pattern_menu) - 1, 0, 0,
+				     ARRAY_SIZE(test_pattern_menu), 0, 0,
 				     test_pattern_menu);
 	if (hdl->error) {
 		ret = hdl->error;


Let me know if you see issues with this.

>  };
>  
>  static int ov965x_initialize_controls(struct ov965x *ov965x)

-- 
Regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi

  reply	other threads:[~2017-10-25 10:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-23 17:30 [PATCH] media: ov9650: remove unnecessary terminated entry in menu items array Akinobu Mita
2017-10-25 10:23 ` Sakari Ailus [this message]
2017-10-25 15:22   ` Akinobu Mita
2017-10-25 16:08     ` Sakari Ailus

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=20171025102307.qjvqtorri4lw3weo@valkosipuli.retiisi.org.uk \
    --to=sakari.ailus@iki.fi \
    --cc=akinobu.mita@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@s-opensource.com \
    --cc=sylvester.nawrocki@gmail.com \
    /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.