From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ulf Hansson 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> References: <20190228135919.3747-1-ulf.hansson@linaro.org> Return-path: In-Reply-To: <20190228135919.3747-1-ulf.hansson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org 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 List-Id: linux-arm-msm@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 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(-) 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 -- 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 836DDC43381 for ; Thu, 28 Feb 2019 14:01:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D1202183F for ; Thu, 28 Feb 2019 14:01:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aeWxhcpC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FVXnHtLF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D1202183F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=nKDQiJ4u6GD4YPJ3AdLKKHZUPa5FK/ZqzfjeBSmUrmQ=; b=aeWxhcpCOurZrYZzxdgbr40+uF cwuo/T/N4Vw4zFMSSxpEUpfe+RGYNYDSfzwJ/kXrhaBhtShfa92zRboIT4Mpa6Z7zEh+0vSZ4Pe0h cF3zzOHOo12IHsvMc8txSujwPtI6DOAa7g6xRv/V0RxHoxCyrFJRUc7qMkWKEvPmAVpfKCBCghmLo /jtHI7oNR4dxhRIi/PCjJmcPH/NAnf/WhhDs0LpHuvirEkQfr4q9XUVSyDuTFMlNQmVUGfnWi/vKy 2tK/HQ05EOnXmnVJ5ptOx6z9H5DYW9OA0XyNJHFgtcW7nltFK5XuCZSIp57AZlS8IKExWi3FSFNRw 6yrKPQ/g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzMFD-0000oc-46; Thu, 28 Feb 2019 14:01:03 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzMDn-0006ZL-KZ for linux-arm-kernel@lists.infradead.org; Thu, 28 Feb 2019 13:59:37 +0000 Received: by mail-lj1-x241.google.com with SMTP id q128so17180878ljb.11 for ; Thu, 28 Feb 2019 05:59:35 -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=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=BBI4PhpXQJIjRVV3O6+GofCJ+WJEfBK8tN4Q8AbniA7/uyFHUuqxtqFEXFmyOHcIN7 Qq5v15palbRbOTONBhlEXtaa2bFYjLWmJemDgdskfrRgang65fLonWrj/7HxcJAsZ0uL ED9P0MUVGT9KOwal4w2wj/eA+6LCvd4EFzcEETdYzyZ5ZdhNKhQ/a7RgWiosoLIuTHN6 WNk9p7Vc5z9eNJ/JKJKoBqJm98XsQ1YzUyDk2KZ0Js1AZoiSIF/Wmh4BYc7lD8eaeHWL 7t5Rit3NenqZ/FJ3FZ+Wd4DdOOfMERiJrygY/2TimaycDGY5kkyi90i49lDYwH2dVwyn oegw== X-Gm-Message-State: AHQUAuar9fEjNHzdG4phTzevh1ZtEZ/3LHA97Z+QRZOpV/IDv7Kr6MxF pMAaE2NruWt/zyqU6ydE5VwQIA== 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) 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_055935_674151_2C647497 X-CRM114-Status: GOOD ( 15.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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(-) 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 -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel