Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2763620imu; Thu, 29 Nov 2018 09:50:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/XNdZrIT82zkl446l65Mv5EsSBc2o/9DZ8ZXjLqftpU/jDp66CiIYR5RNbyWnMue/6YffEt X-Received: by 2002:a17:902:6b09:: with SMTP id o9mr2391702plk.208.1543513822830; Thu, 29 Nov 2018 09:50:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543513822; cv=none; d=google.com; s=arc-20160816; b=W0eIaVLsajR+ZST0l3zwIo2KDQVAhDOIuIoA/ASpvca806QrG1b6CyJ3TWiEMb3fhh HHUc+NABSh2DdyvkGFx/bZfhUMz9Ubn1AbAGdKWNRmbE6NuBL3HDH/foHbQMhLg3nOSz oRdTy8Xw2aFNAeWTDys+wMeE/WyZo1CD8C8KHRORQqFH854VeMJzMpcQxifZsInhW6CL knbZDfkQIx3M7scN8alU94ZikUyW7lXEG22qlxDWsMn5P81YbTroZMntOeOGbkOfJIF+ nxdeapm1udrvyPDk1kRbFmUM2FhZDIwon6loF1/YLU+F9UYiGFKQ8PQwhqT/WuSqK5jn sHyQ== 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=sBD1WW7BwpbmmFCBAUM/LkzhQcfLQzzKf8usLisViugsoXZUKMjia5X47aB4Yga0KT uifi72w/85RPE5VrHq6u291Om9YAShTZHklQaXu/19ydM5LsoeEiTqPAhmXcE+bYg3XD sZcfuM6xQE0h2zoVBbESH0P0bU5qoBzIEqKQNjzIH9qTY6R9qXZQMQPxZbIUsqMdy2da 61aa9l1MCUcBNa6Z9tacgFBh/tAmalJJz6ExtzevLOnqxiQoLjgKpbU1a0hI6Gl9Klwz 58S12CWgCkmb94yE/hpCaQvxd/A076PFCxrfPxRXhozWxNxijB5C4zoyDc5nLqGBouUR EPlg== 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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 i66si3355929pfb.91.2018.11.29.09.50.07; Thu, 29 Nov 2018 09:50:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1730991AbeK3Exp (ORCPT + 99 others); Thu, 29 Nov 2018 23:53:45 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:44563 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730942AbeK3Exo (ORCPT ); Thu, 29 Nov 2018 23:53:44 -0500 Received: by mail-lj1-f193.google.com with SMTP id k19-v6so2511555lji.11 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=QnYjS6a88DOlBypi5H1ylWnzs5cIcim1mI1qdaRRykVsk0TmvETmKxD8cQ1VlwUdag MMy9Pf4Gn+Q3EEEKQY/332xHZ53EwMMKwZDFBq6sZXBMY2NkbgvS0vyOhsx5q+xdnfQJ wEjEXGGAmUZI61otE2ZvZA7MGMvdNhEtRWMJt3Yw1fgR/aNr5vZ2URrksNYEy2BRE7Bq jz7LyJjbguuzs847A6Nc+zhj3bwUOw3qo4ZRfxt4yauA9Zq+ZRhDAr9tKrpkPbWRTtwk oTK3kqyXUVDq5ohjH4atTmO6qQ+Luz/E3vSTkhVn93hDy5ahh/CEZbm0vPMizgoJs6ht 1rSw== X-Gm-Message-State: AA+aEWb8ZyahAZYSo/ODXdofd/eDxJ+GLC++8mgZwQb6LvMuP2/smnO9 WVL9SvOx+IW+d8bYpJl6XPPvTA== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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 -- 2.17.1