From patchwork Thu Apr 21 23:42:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12822500 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 6FBA3C4321E for ; Thu, 21 Apr 2022 23:42:59 +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=n316QfWfMjYdTkqjl97Yo4H2rx5DdazxJaGNsamgfqw=; b=iTkCUV2uwPKzHh mgvczB2Cqh6TokYuX1/lcTDo826r7adVgdn885sByFypPwWlDWYhtKhnY6mWYDeeP5kpLQ/67X9Ck 6qTNND9vFFzJPYGfv+wFwWEzHaRP2DmMQR+Vlz2UJjiLDKmjY8m1MKoRS2smHAa65qAmoehvoms9d 7ovfZKy9SCn1bBgJTMxS2gZGWQi2jLdkQm3imZJrR6jfBXSr3SYu3wkdQ4Tw+Xn584NXv50l80lmI KG/xcw8J9hOBw0pUl+L41XWi2S/ZZDErpcB3C8X5K/+jGYsNZgc3nuZhpoLkmQjhYHRdE3jFN7Rb6 4mJ2mVWlvoRDoMoiu64w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhgRq-00FNsQ-Lj; Thu, 21 Apr 2022 23:42:54 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhgRk-00FNmx-JE for linux-rockchip@lists.infradead.org; Thu, 21 Apr 2022 23:42:51 +0000 Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DDBD44A8; Fri, 22 Apr 2022 01:42:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1650584564; bh=+EEZaI1Sr64pv4WdRxOC2fjz5M1NMfScxLNyvwwsUYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=piyFUWpUlBZXAB9PLDO4R+mbp0uNMH1Ivb040g7hO2h4zIVRCPbP3CYpes6N8WN9h f4CbdrZyg6bL6YWQoAYQC8EAIfe9FnTqdC9M8L2io5jmAGjK3/emTyeVJ1JjgEDInh Kzb9KC6aTJLihscQblPc5ESRxomYAN4EYXydqnhU= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Dafna Hirschfeld , Heiko Stuebner , Paul Elder , Tomasz Figa , linux-rockchip@lists.infradead.org Subject: [PATCH v4 01/21] media: rkisp1: capture: Initialize entity before video device Date: Fri, 22 Apr 2022 02:42:20 +0300 Message-Id: <20220421234240.1694-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220421234240.1694-1-laurent.pinchart@ideasonboard.com> References: <20220421234240.1694-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220421_164248_827510_288D328F X-CRM114-Status: UNSURE ( 8.11 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org The media_entity embedded in the video_device needs to be initialized before registering the video_device. Do so. Signed-off-by: Laurent Pinchart Reviewed-by: Dafna Hirschfeld Reviewed-by: Jacopo Mondi Reviewed-by: Ricardo Ribalda --- .../platform/rockchip/rkisp1/rkisp1-capture.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c index fee2aaacb26b..e88749488969 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c @@ -1386,22 +1386,25 @@ static int rkisp1_register_capture(struct rkisp1_capture *cap) vdev->queue = q; + ret = media_entity_pads_init(&vdev->entity, 1, &node->pad); + if (ret) + return ret; + ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); if (ret) { dev_err(cap->rkisp1->dev, "failed to register %s, ret=%d\n", vdev->name, ret); - return ret; + goto error; } + v4l2_info(v4l2_dev, "registered %s as /dev/video%d\n", vdev->name, vdev->num); - ret = media_entity_pads_init(&vdev->entity, 1, &node->pad); - if (ret) { - video_unregister_device(vdev); - return ret; - } - return 0; + +error: + media_entity_cleanup(&vdev->entity); + return ret; } static void