Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1033899imm; Wed, 20 Jun 2018 10:26:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIebS35HXqCAHe81Emy/WQw6nODfKqdJ4zKYE7ymWs9vSQx4Vk1k8biAmxZVWiG21MgHC9E X-Received: by 2002:aa7:8491:: with SMTP id u17-v6mr23869820pfn.48.1529515594449; Wed, 20 Jun 2018 10:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529515594; cv=none; d=google.com; s=arc-20160816; b=R2v3IpkPqzi8oeG7CgDFmQZtVZ4X0KfbAt5XGy/+6mChU8fbEpmpUScUAJkKbkGoJ+ KcHnUOOzgxwMBeu2vS958iUuamb83wULCFz/04iJw9LwvJfVunzC6Ba4XtBBs1o1EJu4 bxuto7bggk19LbIdIgmUeQY5eJmiLDGU0Pe3CYCRl9NTP6jWrS4u/1nLhDfD4G33Q6dT AVNTcBHhwE65GANA1LxXMuEbdT3Mz3gLEYbKYsRp0TV0zi5RXN+GvwJDXiiPdkBmUTMb VtPLerXJsmbvrDNxmlQOXiZwnytV6/TRz7DQVw5ndonfQp3cqsUurJ2KJEZ2bZcxaRgP XbnQ== 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:arc-authentication-results; bh=TjQPuSPVMZIQ7LGnNwV9hx0MvmHHDvnmuj1+IqpIlaE=; b=Dp3zMJhzzVntiu5y5c6mTwII2/hCgQYEgke3BoIf9pwn1MqvaMrTeQsaEJcAVzFzPZ i00nVxL+qsIZQgs/Qh8Gem3cy1COW5Fvbnde69x1yglzYgaFpvNUWkKOgMe++ulG650n Sn14po+wc8ephvE8t3rL12PwTRUc2jovXj0sxTLMwsj0Y9P3xDOf4Z6wIwkzYl43SPxB xgQR8oB/B2iJLhpt7xPAO4i3g0+f/8zGGt4Y0IZJftzoe8WHSm8KBgmgDF+5L20Z/PDO gy7kRH/04tYAzzvUrJ+LwMk6bZk73YWFl03vdcIsTJriWfcVT31WYErnERiony3mc6Vl hhRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FperrAB5; 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 x18-v6si2777524pff.196.2018.06.20.10.26.20; Wed, 20 Jun 2018 10:26:34 -0700 (PDT) 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=FperrAB5; 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 S932727AbeFTRXM (ORCPT + 99 others); Wed, 20 Jun 2018 13:23:12 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:34234 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754591AbeFTRXH (ORCPT ); Wed, 20 Jun 2018 13:23:07 -0400 Received: by mail-lf0-f65.google.com with SMTP id e13-v6so504133lfc.1 for ; Wed, 20 Jun 2018 10:23:06 -0700 (PDT) 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=TjQPuSPVMZIQ7LGnNwV9hx0MvmHHDvnmuj1+IqpIlaE=; b=FperrAB5E7YDSjYoP6q0jhEs2Ox1HY0CxDVeDxyDEatvk5EZ/4z2r8mMTpWW2c/L4s gkPJqTo9YiUfQY1rNcGhu8tbZfXXmVL7mgsOkFqSiSEH03eiQBsLjeQ4zNQ7OebEbRfa U+dUGEMYyssb5EltEDwG3oNn2SDVaeN8eJijM= 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=TjQPuSPVMZIQ7LGnNwV9hx0MvmHHDvnmuj1+IqpIlaE=; b=K8JoltLLdiKfV+2GkYeEI9RDfepEOxFJ3+srxzayJZ91favZJCf1pGU3pAB101wzV/ V19kF0Zi+M8OXX+PrNP6VfNbtz5TM+ZAXE3J8LLRpLNhXvNMOmdOlLxfdINroBMruZNn 9AKLuXANAzABHNpsS0Ojw6l7N7lrXHdEWXqdDE85oi3xAuAw8FZvShsWy2PSU1Pwftxs 31/cR11FgoPLRcL+B02HuRzNvWPpj7u+NR5LP+Jc8jbMZh2g2DVuIKXxyh3W/A4Jo+cf 7lXNyF9YTPfH6QLO1jvuyNKdTxUlaX8peiU0vJ76c9rxdkeJRqzlU4kGmUKRCtNsn/TV 5q0g== X-Gm-Message-State: APt69E1Gz7k/5vMTmu+e/8Ay7c02Vyzjhm7qMggPT011UrEdpK/thwcN LPdLf+/mdWA7EHffe9B38Je/Og== X-Received: by 2002:a2e:9ac4:: with SMTP id p4-v6mr14792545ljj.60.1529515386233; Wed, 20 Jun 2018 10:23:06 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id b2-v6sm514441lji.85.2018.06.20.10.23.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 10:23:05 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org Cc: Kevin Hilman , Lina Iyer , Lina Iyer , Ulf Hansson , Rob Herring , Daniel Lezcano , Thomas Gleixner , Vincent Guittot , Stephen Boyd , Juri Lelli , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 17/26] drivers: firmware: psci: Simplify error path of psci_dt_init() Date: Wed, 20 Jun 2018 19:22:17 +0200 Message-Id: <20180620172226.15012-18-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620172226.15012-1-ulf.hansson@linaro.org> References: <20180620172226.15012-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 --- 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 256b4edbb20a..38881007584e 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -608,9 +608,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 @@ -618,11 +618,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(); } /* @@ -634,9 +630,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"); @@ -660,9 +655,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 = { @@ -677,6 +670,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); @@ -684,7 +678,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