Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96E76C04AB6 for ; Fri, 31 May 2019 11:35:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F63324C41 for ; Fri, 31 May 2019 11:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726275AbfEaLf2 (ORCPT ); Fri, 31 May 2019 07:35:28 -0400 Received: from mga02.intel.com ([134.134.136.20]:60749 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726158AbfEaLf1 (ORCPT ); Fri, 31 May 2019 07:35:27 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 May 2019 04:35:26 -0700 X-ExtLoop1: 1 Received: from paasikivi.fi.intel.com ([10.237.72.42]) by fmsmga007.fm.intel.com with ESMTP; 31 May 2019 04:35:25 -0700 Received: from punajuuri.localdomain (punajuuri.localdomain [192.168.240.130]) by paasikivi.fi.intel.com (Postfix) with ESMTPS id 75111207C2; Fri, 31 May 2019 14:35:24 +0300 (EEST) Received: from sailus by punajuuri.localdomain with local (Exim 4.89) (envelope-from ) id 1hWfox-00044l-04; Fri, 31 May 2019 14:35:39 +0300 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: hverkuil@sx4all.nl, Janusz Krzysztofik Subject: [PATCH 1/1] v4l2-subdev: Try formats are only available if subdev API is enabled Date: Fri, 31 May 2019 14:35:38 +0300 Message-Id: <20190531113538.15628-1-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.11.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Return an error for which == V4L2_SUBDEV_FORMAT_TRY if CONFIG_VIDEO_V4L2_SUBDEV_API is not enabled. This is because the try formats are not available in that case. Do the check here so that drivers don't need to. Signed-off-by: Sakari Ailus Depends-on: ("media: v4l2-subdev: Verify v4l2_subdev_call() pad config argument") --- drivers/media/v4l2-core/v4l2-subdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 34219e489be27..88b4b9d7c41be 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -122,7 +122,10 @@ static int subdev_close(struct file *file) static inline int check_which(__u32 which) { - if (which != V4L2_SUBDEV_FORMAT_TRY && + if ( +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API + which != V4L2_SUBDEV_FORMAT_TRY && +#endif which != V4L2_SUBDEV_FORMAT_ACTIVE) return -EINVAL; -- 2.11.0