From patchwork Tue Jan 30 15:18:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hans Verkuil (hansverk)" X-Patchwork-Id: 46759 Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egXgJ-0002OO-LC; Tue, 30 Jan 2018 15:18:44 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752946AbeA3PSi (ORCPT + 1 other); Tue, 30 Jan 2018 10:18:38 -0500 Received: from aer-iport-2.cisco.com ([173.38.203.52]:20983 "EHLO aer-iport-2.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751934AbeA3PSg (ORCPT ); Tue, 30 Jan 2018 10:18:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1086; q=dns/txt; s=iport; t=1517325516; x=1518535116; h=to:from:subject:message-id:date:mime-version: content-transfer-encoding; bh=TMWLUPqH7CrZC7JteMuEs1XACq3OM9XZSFdjtGK5UuU=; b=Ny79GIl8ZoedbrGyshsAbEIXfw2UPWl/d82x/gyDl7Ob3B/k7MfIxN0i TiQ/pPWZCjNWoTo7+VZF89xfA01YwwT6kNxTbDgkwri8Sv+TqjBDILYPx SlMc9gacuMooFgBY3QBqnqXcuVaw6wly/Y0SiptLAjIU8GULxBeo8pOl2 I=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0BwAQCdi3Ba/xbLJq1bGQEBAQEBAQEBA?= =?us-ascii?q?QEBAQcBAQEBAYUdKINgixipWAqIWRQBAQEBAQEBAQJrKIVNBIEHAiYCXw0GAgE?= =?us-ascii?q?BijGlfYFtOoplAQEIAiaBD4NIg2yBaCmEToFmBIE4g06CZQWkF5VojC2HegJIl?= =?us-ascii?q?nICBAsCGQGBPDYigVAzGggbFYJngmGCF0A3jCKCSwEBAQ?= X-IronPort-AV: E=Sophos;i="5.46,435,1511827200"; d="scan'208";a="1749144" Received: from aer-iport-nat.cisco.com (HELO aer-core-3.cisco.com) ([173.38.203.22]) by aer-iport-2.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jan 2018 15:18:33 +0000 Received: from [10.47.79.81] ([10.47.79.81]) (authenticated bits=0) by aer-core-3.cisco.com (8.14.5/8.14.5) with ESMTP id w0UFIWCl012106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Tue, 30 Jan 2018 15:18:33 GMT To: Linux Media Mailing List From: Hans Verkuil Subject: [PATCH] v4l2-compat-ioctl32.c: make ctrl_is_pointer work for subdevs Message-ID: Date: Tue, 30 Jan 2018 16:18:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Language: en-US X-Authenticated-User: hansverk Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org If the device is of type VFL_TYPE_SUBDEV then vdev->ioctl_ops is NULL so the 'if (!ops->vidioc_query_ext_ctrl)' check would fail. Add a test for !ops to the condition. All sub-devices that have controls will use the control framework, so they do not have an equivalent to ops->vidioc_query_ext_ctrl. Returning false if ops is NULL is the correct thing to do here. Signed-off-by: Hans Verkuil Acked-by: Sakari Ailus Reviewed-by: Laurent Pinchart --- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index bdb5c226d01c..5198c9eeb348 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -770,7 +770,7 @@ static inline bool ctrl_is_pointer(struct file *file, u32 id) return ctrl && ctrl->is_ptr; } - if (!ops->vidioc_query_ext_ctrl) + if (!ops || !ops->vidioc_query_ext_ctrl) return false; return !ops->vidioc_query_ext_ctrl(file, fh, &qec) &&