From patchwork Wed Jun 2 08:47:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 12293433 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=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 1C136C4708F for ; Wed, 2 Jun 2021 08:47:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05838613AC for ; Wed, 2 Jun 2021 08:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232814AbhFBItT (ORCPT ); Wed, 2 Jun 2021 04:49:19 -0400 Received: from lb2-smtp-cloud8.xs4all.net ([194.109.24.25]:57325 "EHLO lb2-smtp-cloud8.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230517AbhFBItT (ORCPT ); Wed, 2 Jun 2021 04:49:19 -0400 Received: from cust-b5b5937f ([IPv6:fc0c:c16d:66b8:757f:c639:739b:9d66:799d]) by smtp-cloud8.xs4all.net with ESMTPA id oMXElTqt9IpGyoMXHlP1M5; Wed, 02 Jun 2021 10:47:35 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s2; t=1622623655; bh=GeBnTPsbpVKLWCT7oZPo+DnHu/e6dwvW2f1gxsMyohU=; h=To:From:Subject:Message-ID:Date:MIME-Version:Content-Type:From: Subject; b=MwVq85Xq7OQah8Nk+bbZKrPaVUXNf/sC8s92MVT0CF+8MKvXdcQe7qAj7eqBXTdSF kw0NY1GlygT3Pw8JtDmLBrCnLAVQY6MyGKyrSy/M+KKqzsx9yHkeL/SNKBQKKOenkq ztNHv+ZEuW3Qbbmrwd8woxyOibaOYBa3TAx7p4X2xcrlYkpZRQDXFBJ7tLIqMx5S+6 FrdWitaJdFMkChaY1trqAI+dXs966SzjIEx1GJaAIQ2bRXy0FXjd09FjegNaeTEf1U //Laa//aKpnODbLZTBSF3tJz2RH2SeeuHmxJj9Vu6QmzMUpyYbzSRL4hUfPRGdX26C WPc8jtKOfpJSQ== To: Linux Media Mailing List From: Hans Verkuil Subject: [PATCH] mc-request.c: allow object_bind in QUEUED state Message-ID: Date: Wed, 2 Jun 2021 10:47:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.10.0 MIME-Version: 1.0 Content-Language: en-US X-CMAE-Envelope: MS4xfJZw4oLeE5/ILNITRzKt0vz4ukMrtZ0nPz6P75pnNH8jFHtNw1cZ6s9O3cY5tg2U5VlLKdoke5jnG/2JfjMzXQBdey1VA9HQwsE17JLSGmsXO+stY1Vk dEYeO1bwCYHbhryv/ZXV4HT19SRLaC+KprGb6lPvOF8NklQfYQGcHm4TmZsXp8jPmwwm9YR45/WSkPe3l5KVmvUI0FrsI2TyUaI= Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org If a request was queued without a control handler object, and a control handler object is then created and bound to the request when copying controls on request completion, then a WARN_ON in mc-request.c is triggered since at that time the request is in state QUEUED, and not UPDATING. But this is too strict, and in this case it must also allow binding objects when in state QUEUED. This patch was unfortunately lost when the "always copy the controls on completion" patch was posted, it should have been part of that commit. Signed-off-by: Hans Verkuil Fixes: c3bf5129f339 ("media: v4l2-ctrls: always copy the controls on completion") --- drivers/media/mc/mc-request.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/mc/mc-request.c b/drivers/media/mc/mc-request.c index c0782fd96c59..addb8f2d8939 100644 --- a/drivers/media/mc/mc-request.c +++ b/drivers/media/mc/mc-request.c @@ -414,7 +414,8 @@ int media_request_object_bind(struct media_request *req, spin_lock_irqsave(&req->lock, flags); - if (WARN_ON(req->state != MEDIA_REQUEST_STATE_UPDATING)) + if (WARN_ON(req->state != MEDIA_REQUEST_STATE_UPDATING && + req->state != MEDIA_REQUEST_STATE_QUEUED)) goto unlock; obj->req = req;