From patchwork Sat Mar 19 16:30:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 553139 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9200C433F5 for ; Sat, 19 Mar 2022 16:31:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243634AbiCSQct (ORCPT ); Sat, 19 Mar 2022 12:32:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243637AbiCSQcs (ORCPT ); Sat, 19 Mar 2022 12:32:48 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B32BF21C73A for ; Sat, 19 Mar 2022 09:31:27 -0700 (PDT) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B4752898; Sat, 19 Mar 2022 17:31:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1647707485; bh=+EEZaI1Sr64pv4WdRxOC2fjz5M1NMfScxLNyvwwsUYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pvs659Yb0nrkMtD0+dL8bi0JPXvumYFQvUksTM2MI4ETJ/q9oCgqOy9uBeJqo4n22 BjaSUnAWlqxExt7L29kcXDNeqNpMHUMR1bb69cMKQ9B7Ni97+cezSz7l18bTMfwnBq 2haR1RzqDLneXQ+gMcf4NMcwWevz7tSQs1KwdEJs= 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 v3 01/17] media: rkisp1: capture: Initialize entity before video device Date: Sat, 19 Mar 2022 18:30:44 +0200 Message-Id: <20220319163100.3083-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220319163100.3083-1-laurent.pinchart@ideasonboard.com> References: <20220319163100.3083-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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 --- .../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