From patchwork Wed Nov 2 18:08:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 13028776 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F493C433FE for ; Wed, 2 Nov 2022 18:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Vp0Wk1qLvdnxNdWusJiYASKhGuOQeLbRUyXiX4Q3Qas=; b=rlq+dWubG3XzNm xrGrqHDjH50n4+cC+3Yr1CXKcdjZ+/wICPBpteIXHKjd22GB2iTqMRttoyun9we2d8zQ2SvLJ5bmR 3YqVau5KjprVpOjB34j841dPZTVQxiyNA7TYRLKNa/lPCfQ5FzCafmQ309G5wX7TRzrwXJxuaKFUw l3d6zmaY1oM/bb3BsxWfctY9CSrKymCNtBWV8AtjAK+qX/krzmjLOQ90fJY7ebDbxKTuVzSGPbZPG abKbVG/+1mxvX2g0grK0JDUxCdd4TOvrAP6bkw7O2tawfxIsH4MQmISfFqoPpgQFBE09mEq35nGLk kpRZPIMSbEPdSL1GIa4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqILw-00CwLT-VB; Wed, 02 Nov 2022 18:20:42 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqIA9-00Comj-Ki for linux-arm-kernel@lists.infradead.org; Wed, 02 Nov 2022 18:08:31 +0000 Received: by mail-ed1-x533.google.com with SMTP id f7so22045545edc.6 for ; Wed, 02 Nov 2022 11:08:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lOVecSCg58WLAt5MFbBf+7umb5iX32HjizH1LHXmtzY=; b=c4sCG5TAZ2UUoS2lgWb76UO1do1+DNv9lhf4f4V7zz8ljX4X5EhvcAsgEefuVLOg+q gaywl+w/4OLpyHt3F/9Bwyiwk5P2gVSKETjqXN25CxxveeMkl1P02LTapxNRpEbc4ncS y0DtjSpEZpoo2aYks0chPXEMt1SraV5egn74lh0bqLCfULmWstsxoJQzoNKJwcM24qu5 exgx3cKeSyDCHntD25R80Aed0dN9MnlXk9pnJP8nJ5srwQ3D4KTDuWMqgQDoOgnlpd23 V9+2EcH2DuN9nLi3yQK1rC1Vva6WPZ/ddX8HBC+0qQqm0AeUMYHozRY7sbi8QTnZCa4A ZmUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lOVecSCg58WLAt5MFbBf+7umb5iX32HjizH1LHXmtzY=; b=vS+wYzw9CA9u3OJ9uFyVbgho9uR4ESpHbFC0M3lJ4rCFf1kBQeElp4B8CkUGusGwoO j6TrdFmvxG19OeffzJuaXwGeJxj34coRcYWw+ZxZwy4ry49PtCD6wTVJB8agHNYMZXv2 FKKj+Vz/Ktca0VJvtCinI262CspTySNqiXsWYRu0CweeJ70ZdCq/z1vewN3Ge+X2uOTS Nza9CvMVTFAUle2PFDjaM+8yG8+s7602dtgW9FwMfMTDRU/OZrrGKb4pvQGRhU8a1obq ERdtbCKLJUTwekNsSoZ5BOXNX+mSkXaCK+WtgivlBVlNiYROaDy1RTFlWwvU3gvkMZpp i31A== X-Gm-Message-State: ACrzQf0Fso/2sl1EYFi6wFeD6vq5ZIQdwza2DjGTjkL01yoRYhuy+Cjf 0Re1RysR2lGN4pOzdT7dUxQ= X-Google-Smtp-Source: AMsMyM6muLY2M00Knxi/o8lVph4GJlPIjeZVu+nV5Y9ZTqSo+P6497kNAnSyQ3n27WFCtlCImp3mvg== X-Received: by 2002:a05:6402:249b:b0:460:cb11:27d4 with SMTP id q27-20020a056402249b00b00460cb1127d4mr25895603eda.410.1667412507718; Wed, 02 Nov 2022 11:08:27 -0700 (PDT) Received: from kista.localdomain (82-149-19-102.dynamic.telemach.net. [82.149.19.102]) by smtp.gmail.com with ESMTPSA id gy8-20020a170906f24800b007317f017e64sm5677460ejb.134.2022.11.02.11.08.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 11:08:27 -0700 (PDT) From: Jernej Skrabec To: mripard@kernel.org, paul.kocialkowski@bootlin.com Cc: mchehab@kernel.org, gregkh@linuxfoundation.org, wens@csie.org, samuel@sholland.org, hverkuil-cisco@xs4all.nl, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Jernej Skrabec Subject: [PATCH v2 09/11] media: cedrus: initialize controls a bit later Date: Wed, 2 Nov 2022 19:08:08 +0100 Message-Id: <20221102180810.267252-10-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221102180810.267252-1-jernej.skrabec@gmail.com> References: <20221102180810.267252-1-jernej.skrabec@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221102_110829_730926_8B332560 X-CRM114-Status: GOOD ( 12.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org While it doesn't matter if controls are initialized before or after queues and formats from open handler standpoint, initializing them last helps keeping s_ctrl handler simpler, since everything has already valid values. This is just preparation for follow up changes. No functional change is intended. Signed-off-by: Jernej Skrabec --- drivers/staging/media/sunxi/cedrus/cedrus.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c index 37b1df9a9d6a..6a2c08928613 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -355,27 +355,27 @@ static int cedrus_open(struct file *file) file->private_data = &ctx->fh; ctx->dev = dev; - ret = cedrus_init_ctrls(dev, ctx); - if (ret) - goto err_free; - ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, &cedrus_queue_init); if (IS_ERR(ctx->fh.m2m_ctx)) { ret = PTR_ERR(ctx->fh.m2m_ctx); - goto err_ctrls; + goto err_free; } cedrus_reset_out_format(ctx); + ret = cedrus_init_ctrls(dev, ctx); + if (ret) + goto err_m2m_release; + v4l2_fh_add(&ctx->fh); mutex_unlock(&dev->dev_mutex); return 0; -err_ctrls: - v4l2_ctrl_handler_free(&ctx->hdl); +err_m2m_release: + v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); err_free: kfree(ctx); mutex_unlock(&dev->dev_mutex);