From patchwork Tue Apr 13 18:02:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 73244 Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1lWNOR-007E46-Ps; Tue, 13 Apr 2021 18:04:08 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347504AbhDMSEZ (ORCPT + 1 other); Tue, 13 Apr 2021 14:04:25 -0400 Received: from bin-mail-out-06.binero.net ([195.74.38.229]:27654 "EHLO bin-mail-out-06.binero.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237671AbhDMSEW (ORCPT ); Tue, 13 Apr 2021 14:04:22 -0400 X-Halon-ID: a026fc46-9c82-11eb-aed0-005056917f90 Authorized-sender: niklas.soderlund@fsdn.se Received: from bismarck.berto.se (p54ac5521.dip0.t-ipconnect.de [84.172.85.33]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id a026fc46-9c82-11eb-aed0-005056917f90; Tue, 13 Apr 2021 20:04:01 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Hans Verkuil , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH 02/11] rcar-vin: Fix error paths for rvin_mc_init() Date: Tue, 13 Apr 2021 20:02:44 +0200 Message-Id: <20210413180253.2575451-3-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210413180253.2575451-1-niklas.soderlund+renesas@ragnatech.se> References: <20210413180253.2575451-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.4 (--) X-LSpam-Report: No, score=-2.4 required=5.0 tests=BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no The error paths of rvin_mc_init() do not clean up properly, fix this. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- drivers/media/platform/rcar-vin/rcar-core.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index c798dc9409e4cdcd..d4932f7b42647ee1 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -946,17 +946,23 @@ static int rvin_mc_init(struct rvin_dev *vin) if (ret) return ret; + ret = rvin_create_controls(vin, NULL); + if (ret < 0) + return ret; + ret = rvin_group_get(vin); if (ret) - return ret; + goto err_controls; ret = rvin_mc_parse_of_graph(vin); if (ret) - rvin_group_put(vin); + goto err_group; - ret = rvin_create_controls(vin, NULL); - if (ret < 0) - return ret; + return 0; +err_group: + rvin_group_put(vin); +err_controls: + rvin_free_controls(vin); return ret; }