From patchwork Thu Feb 28 13:59:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 159375 Delivered-To: patches@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp671390jad; Thu, 28 Feb 2019 05:59:34 -0800 (PST) X-Received: by 2002:a2e:8157:: with SMTP id t23mr4613791ljg.195.1551362374432; Thu, 28 Feb 2019 05:59:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551362374; cv=none; d=google.com; s=arc-20160816; b=la+jbMdBCy1bPosyEjI+DcxElDbRqJjjIAa/UwYe4CvcMW6k+QNi3hOPn07ekSoewp q9AuLqTKsF+pz2oHuxHJV0apMgpUBnso33CuTmI6g4Aii8/LGNZuD9+ABlXi0eNSLtn6 dx1lGxdj9br4i0ao6vAwooKsU8xBzP4r5csdBBo6qTm4V8jrCywmUvKNOAugNnP0ecCa lmsdrQmGzKerMem15GH1QdyqRUdt7A0SrKmrbCnTChuECLiXgfWpdrLQbofMWgyFz/P8 l3dK2Vc8GSybUMiAtezXndanpMrzLoF0Pv9+zX3nXLoKTBz1ztDmTn3RqNBZzkK7L4Ot BpEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hYUbL8LbBo82QhtQinEvxE8lGJZ9H5Ith2yhnCB+jfs=; b=MzwXRieMUxLAm5PlIFXAd+z3Bmz0ovKvGQOH3Xb0T7ShTrwkb54uHTvCCd/B1G4bLq ze76r7AHutTijfYguZPz4vj4G+oQfqtT7hqScy2MTl4b1C043C0JAmSOAsRsnZbtkoA/ o9DMQxsHlipjNCLMa3UR9lUjz82ohQlIYUYHlSHrfVRCIojx2svcizvJcjyHEp7Pmj9n wyJHJoYgTfWdIjJRtihYuGszt7emcK+jcm/khBFHb1L745cTL8cfKm57nkN1M8J8sDEe UT8kK28ggtHbAqkXrQaopL+MeHXZnbHHjn6t8vv2O7uY2KkiOG13UHgxw11dNpiS+By5 T1OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVXnHtLF; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w12sor11455444ljw.31.2019.02.28.05.59.34 for (Google Transport Security); Thu, 28 Feb 2019 05:59:34 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVXnHtLF; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=hYUbL8LbBo82QhtQinEvxE8lGJZ9H5Ith2yhnCB+jfs=; b=FVXnHtLFTrcIsi6QjOHvDk72G+oUmcjjHSBm6gOpkR8yahj/V1QIS1G5ehizJn1wuA 6WDxEgGJRdSbqz4DDEbcVpENyPnwXeqdMWWNAFf9lN+6qzc9QRoeSDhIWF+icNXyz6fW UQYxOWQ4ENTXypM11P/07ftev62Jo66OAGARyGbzZPAlGiLw1OnYzQa9rghzecD48VB6 cBpxHW47WDo70pErlO17ptrY7aJUSIdPaZ0DoE7aUGropbrhf5DwN3jkIUXNm1Aj6hXX xnXciiS5mAPAWRrtfhwI6rkU1IsSbT5aiYPp1XShUC+jNSV0amTsj6e+DCLyveFBNam8 2A5Q== 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=hYUbL8LbBo82QhtQinEvxE8lGJZ9H5Ith2yhnCB+jfs=; b=jzwQhhrHsMN2L+6bxEB/8PGnswzx5mPIZqZo6LCZoZFdSdPx5jWH1pJF4arzvC0i3X 0n0oa7n2ikTOhVOVlC+sb9Z+DpIlXhcY0zlMmOWCxXZav6PANBvG+lQjTHD1OSbUbawA YTzqCADEYP2DOA7jJTZo5CvfhGc6P3vV32SC0S/EAMstoDoZnjDQ41HzJQHP1QMBYSNr qAkVz3OJaWWGwNK+Mwk3Xr5cgpthv8+wHTSknHGlb6wrnAeuDUv87hn3PdveZ3LRoxSY kkw12xBGps8pcHboDuXGXXolta7rCBxrOzj5vKl2WNWf8xXj9z2gOakxxN+gWr7mHgg5 qjPg== X-Gm-Message-State: AHQUAuY7uD5pMoXJMi7UaStNnYserB0+h/z3cOG0eeB4GKjLLutkCoYP ZikfluY/u7GyzBJ2MC9nUaHmNfzx6US2Xw== X-Google-Smtp-Source: AHgI3IZO2Wq9Mtzo7x2cc9k3I15Qn/9ArqedLsbZ57QDgmSES47es6+2O5q3dGm9ObdOHf0PNMrJ8w== X-Received: by 2002:a2e:2202:: with SMTP id i2mr5173940lji.170.1551362374036; Thu, 28 Feb 2019 05:59:34 -0800 (PST) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id v20sm4090265ljv.83.2019.02.28.05.59.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 05:59:33 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland Cc: Daniel Lezcano , Lina Iyer , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] drivers: firmware: psci: Simplify error path of psci_dt_init() Date: Thu, 28 Feb 2019 14:59:18 +0100 Message-Id: <20190228135919.3747-7-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190228135919.3747-1-ulf.hansson@linaro.org> References: <20190228135919.3747-1-ulf.hansson@linaro.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 Acked-by: Mark Rutland Reviewed-by: Daniel Lezcano Signed-off-by: Ulf Hansson --- 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 cbfc936d251c..14d25b54b9f2 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