From patchwork Wed Oct 25 10:23:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 10026453 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CF2D16032C for ; Wed, 25 Oct 2017 10:23:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BADDA1FF3E for ; Wed, 25 Oct 2017 10:23:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFA6827FA1; Wed, 25 Oct 2017 10:23:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A8211FF3E for ; Wed, 25 Oct 2017 10:23:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932452AbdJYKXM (ORCPT ); Wed, 25 Oct 2017 06:23:12 -0400 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:57466 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932267AbdJYKXK (ORCPT ); Wed, 25 Oct 2017 06:23:10 -0400 Received: from valkosipuli.localdomain (valkosipuli.retiisi.org.uk [IPv6:2001:1bc8:1a6:d3d5::80:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id 4D59D600CC; Wed, 25 Oct 2017 13:23:08 +0300 (EEST) Received: from sakke by valkosipuli.localdomain with local (Exim 4.89) (envelope-from ) id 1e7Iq3-0002s7-Se; Wed, 25 Oct 2017 13:23:07 +0300 Date: Wed, 25 Oct 2017 13:23:07 +0300 From: Sakari Ailus To: Akinobu Mita Cc: linux-media@vger.kernel.org, Sylwester Nawrocki , Mauro Carvalho Chehab Subject: Re: [PATCH] media: ov9650: remove unnecessary terminated entry in menu items array Message-ID: <20171025102307.qjvqtorri4lw3weo@valkosipuli.retiisi.org.uk> References: <1508779826-12499-1-git-send-email-akinobu.mita@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1508779826-12499-1-git-send-email-akinobu.mita@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 > Cc: Mauro Carvalho Chehab > Signed-off-by: Akinobu Mita > --- > 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: Let me know if you see issues with this. > }; > > static int ov965x_initialize_controls(struct ov965x *ov965x) 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;