From patchwork Thu Nov 29 17:46:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 152441 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2672423ljp; Thu, 29 Nov 2018 09:47:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/WaGcRydsI5uCNb2T7/0BXVRdHUZEL85sNjVdYEpb71DICiiCTlx38DRRYeRgelSYzHTnSy X-Received: by 2002:a17:902:227:: with SMTP id 36mr2414963plc.140.1543513656793; Thu, 29 Nov 2018 09:47:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543513656; cv=none; d=google.com; s=arc-20160816; b=Jqvk03b1OTjJW+v224qRiMf6TqgoB2wKQT14ReyEWJ9ZVdmhX4NkOf0DFO05H56nve MlsFRxnn/jj8avrmzvCO+xdOr5OSJO11FZsdzA4at906zBu8Qq0icfaB8ELoYxY0hS16 1PVrvTLQDP2UiQ9aiKLTmuJ8NYYdgT9CMRgyvGDFiHuzrtkuDaCZa6dBvIIO7Uo08C7N 7bHp1bVke2GY3jNNbVSnIj7FrBGjssogQFGW+RDQfUERhWLGwZPj8RrGKX4+ZCRGoiTW HHOi3+lao+kkm+OiNrmVDSOsUl9+cDI6/HfYb5ipWBiykZ4rqNCWKIlIt0TmL5TwiApK /DTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Rtb7ncC0WwEMpjQCLG7tBribMPasaZ8gXOaK80cYa2Y=; b=sV8nLgxDVc29smTvUxWy12lWmc7kMo8unknVcoGTdwsxPkXhpBpAAOJMhSsVI66Hs9 gWsi4FpfjKjOjpAxYoSfHzTawBLnZu+lVPwHRUdvNV105BFU6ZKgmsnA4/Qms/1e5C1i UADBEy4m1H7lBCRzLC5GeXRDzM4VlrJ6PmM0obKlMSMzyxbuH7xE0PFRydRR0Ubg1a+q bHCwhJxUZKd7qMcNwWc0cp8Q2ffuH+HJr4ZVdPWc3kibNy8eMFpH1mymH24FZDZZTtOu zwvXMoDtf8Z3tK209CP3IITjAkB5Hua2REWZWY1QM/i2lS2B8RaKbgq0DTUSZYjPSUHV fISA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YO5P3hwG; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si2599486plz.427.2018.11.29.09.47.36; Thu, 29 Nov 2018 09:47:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YO5P3hwG; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730980AbeK3Exp (ORCPT + 11 others); Thu, 29 Nov 2018 23:53:45 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:35550 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730940AbeK3Exo (ORCPT ); Thu, 29 Nov 2018 23:53:44 -0500 Received: by mail-lj1-f194.google.com with SMTP id x85-v6so2546703ljb.2 for ; Thu, 29 Nov 2018 09:47:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Rtb7ncC0WwEMpjQCLG7tBribMPasaZ8gXOaK80cYa2Y=; b=YO5P3hwGz2f1/PGj8M6IIJCJ+iADNSFbLBsUFJh+FZ0WQVq2L2h0C6vPtpjcJudSN+ 6iWdepfrH5LRe2GaGEODv4e8urAWb5kwAA/Ub/lmuunyphoDeHrSFmg1i0l5N5P4tPyE QD54E4ThDFkrMQtqrBqXe0ymN4yniaZGb4Swc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Rtb7ncC0WwEMpjQCLG7tBribMPasaZ8gXOaK80cYa2Y=; b=T3jWpiMBfBTw2avT3GgQBYiJ+lDSzu7erSMU0m+B4cgaZf0+ZbSBwnWBIcrGAMWMgA 6fLCrwHapPP6QoaCwBzXqksJ81z6Sl7CeqhjNQ0bY+X8oLbBXsKILZpWla3a0kUE2xzV 1Od9GObzikXCs4hDKZ35yHKT/qtHp5XuiWWkf8889GaBfla+4po+cG2OYaYtRaCsUbs2 4NNCvpZwqOn2yOaXqjq3P8Y7qiDQZfNYrCPcaocb6t7z+9Tgb+n7JimQgMmw18Rn/AVj Eobi/NyFzOfA6QMkg+1Md3tkRrP4fO8K1xCAiWPOrcDnrExC3QcBFuNA0PLE8TJ0mcls luvg== X-Gm-Message-State: AA+aEWZXeHPwjQPBRgYv/GJCjYuEWWVPmrwfdKnXLF8AETQsqWwiDPPT yOo9mEAJjHGf+O/XNVJHi6L7bw== X-Received: by 2002:a2e:131a:: with SMTP id 26-v6mr1850088ljt.107.1543513652968; Thu, 29 Nov 2018 09:47:32 -0800 (PST) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id j76-v6sm393983ljb.12.2018.11.29.09.47.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 09:47:32 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Cc: "Raju P . L . S . S . S . N" , Stephen Boyd , Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 14/27] drivers: firmware: psci: Simplify error path of psci_dt_init() Date: Thu, 29 Nov 2018 18:46:47 +0100 Message-Id: <20181129174700.16585-15-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181129174700.16585-1-ulf.hansson@linaro.org> References: <20181129174700.16585-1-ulf.hansson@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Instead of having each psci init function taking care of the of_node_put(), let's deal with that from psci_dt_init(), as this enables a bit simpler error path for each psci init function. Cc: Lina Iyer Co-developed-by: Lina Iyer Signed-off-by: Ulf Hansson Acked-by: Mark Rutland --- Changes in v10: - None. --- drivers/firmware/psci/psci.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index 631e20720a22..6bfa47cbd174 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -609,9 +609,9 @@ static int __init psci_0_2_init(struct device_node *np) int err; err = get_set_conduit_method(np); - if (err) - goto out_put_node; + return err; + /* * Starting with v0.2, the PSCI specification introduced a call * (PSCI_VERSION) that allows probing the firmware version, so @@ -619,11 +619,7 @@ static int __init psci_0_2_init(struct device_node *np) * can be carried out according to the specific version reported * by firmware */ - err = psci_probe(); - -out_put_node: - of_node_put(np); - return err; + return psci_probe(); } /* @@ -635,9 +631,8 @@ static int __init psci_0_1_init(struct device_node *np) int err; err = get_set_conduit_method(np); - if (err) - goto out_put_node; + return err; pr_info("Using PSCI v0.1 Function IDs from DT\n"); @@ -661,9 +656,7 @@ static int __init psci_0_1_init(struct device_node *np) psci_ops.migrate = psci_migrate; } -out_put_node: - of_node_put(np); - return err; + return 0; } static const struct of_device_id psci_of_match[] __initconst = { @@ -678,6 +671,7 @@ int __init psci_dt_init(void) struct device_node *np; const struct of_device_id *matched_np; psci_initcall_t init_fn; + int ret; np = of_find_matching_node_and_match(NULL, psci_of_match, &matched_np); @@ -685,7 +679,10 @@ int __init psci_dt_init(void) return -ENODEV; init_fn = (psci_initcall_t)matched_np->data; - return init_fn(np); + ret = init_fn(np); + + of_node_put(np); + return ret; } #ifdef CONFIG_ACPI