Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5050015imu; Wed, 19 Dec 2018 04:55:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/UhdKAGhljqt4YbgWAS1ZGPozFDkx57zDjTvE2zq1D4WzYYoZzcF8ghKAWW1/yoaBt91QAZ X-Received: by 2002:a17:902:346:: with SMTP id 64mr20756332pld.337.1545224118873; Wed, 19 Dec 2018 04:55:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545224118; cv=none; d=google.com; s=arc-20160816; b=HIy4sD5f83fhdoHm8MV7sXx9bjw/Ss1p8XrXQv2VfPqp10D7BfvrMzllUiyEpmNd0X eoAWvicg4GCL5/pQJZh0J/WCguRyuGEqfKl31d684J6TPmjtsllEBNYWeyDw2jpFwDqn 8loEMyoUy0TBfxNoE6lL64R5nKiIzKtfzLxvN97RXcviF4L6CAoD6vmijOqCMLOmYGeb MFLqGeVvAXP0NV6Lhobt+ra8blQOp0mcXaqu8HmmMePLGteHwkvH8RDvlU6AOsZv6iTQ z8sYmaTzhRhi2klJXOkOXpn7IHOlp5KVZAFqhdMbWVxJr8MsNkrck/DTj1hYst7ZpMHI kr+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=IaqOoapHzjoMgO9YBbjQ3EZTwNanLJVjZn5hJwj2FMk=; b=F6299ivYDjuL26OQ6sQY8Q/AFMEIvBCOUhRkSZp0SzPHrtgkMK2PaSDrCAsebQVZiY XMh66noxP8+glb8pBoiMCgYEo0wsHxwJrcpOvO4ateykMA2yNRSehuWYCg9ZJOBF20FO WWKGo9J7mnpVWGGwAa7sW2JkCZgcBAhp6iCg4QMBVzp/UYQjldEJIItrDdHr8xhfKllk JeUQ0G14ky0Qy6lIJFaFR+PLDdQbYc4tj/lNQLe7xoIYjtuCBgTrozo68WUfd/Pubisg OTLrQf0NgSg6W+Yt1JzWxTPNcSyct7H9QILzRnWk4WzinCB1RIfsyRnNABqyVXJE52Ga SI/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHt6qhdG; 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 g5si4465106plt.273.2018.12.19.04.55.02; Wed, 19 Dec 2018 04:55:18 -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=GHt6qhdG; 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 S1728721AbeLSMIp (ORCPT + 99 others); Wed, 19 Dec 2018 07:08:45 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34402 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728694AbeLSMIp (ORCPT ); Wed, 19 Dec 2018 07:08:45 -0500 Received: by mail-wr1-f67.google.com with SMTP id j2so19298121wrw.1 for ; Wed, 19 Dec 2018 04:08:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=IaqOoapHzjoMgO9YBbjQ3EZTwNanLJVjZn5hJwj2FMk=; b=GHt6qhdGISkevDdYgX9XDmZqTUrpsOtUkVOBKIbGbZmHTLRgl/a+k11cej4RUqVO3/ ftHAHNyASYjk3Cd+UVAXnV/gXUqm/+ebm8lFCLivPHR6828aha3qN+KY1Bac208b8d6I vW4h4x4r6Fik7GSpklOsMsRdqoFGTvmty9v2A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=IaqOoapHzjoMgO9YBbjQ3EZTwNanLJVjZn5hJwj2FMk=; b=Qzvxo6Cp2Uvfg2qu484Hk5xSUw+sT6aU2wTlV4SgYbjDIItKK5e3J6c0T0bPJ9Nwdp 8Rx2M6cEbogYsHHdycEfr3lv7hMY/2j0Jqvw826bM/kNYD9Rbc+igG6RJ26TaG3v6yeH zHBUpzdrX0fFST0Y9BdX6vX5W1FfUocPa6V+y2kavDAmf9TuNQcF89PbjgaWjHwpsUQN dwJbxcmGSMYrToClRC2rtWvm8KEKfS4pv5j9QHBbjQie+d5gq1pXEK+52EiO7RLF8Y5i DGf4vC8oUQ9b6bi7bJsghwX0jHzZadZDs2vozONmhlYBHBmEaJe2/RTPB6Tm8NVbrlmH sOSA== X-Gm-Message-State: AA+aEWZF1bID38taujx8QYBrWriLqsuJdToaHmKVbj1FDbFy5CY9F9uY VI/4BAVPiQZegNfPPxDd/GQzgI+wp5g= X-Received: by 2002:adf:8143:: with SMTP id 61mr17875097wrm.47.1545221322006; Wed, 19 Dec 2018 04:08:42 -0800 (PST) Received: from [192.168.0.40] (197.26.136.77.rev.sfr.net. [77.136.26.197]) by smtp.googlemail.com with ESMTPSA id e142sm12036003wmf.46.2018.12.19.04.08.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 04:08:41 -0800 (PST) Subject: Re: [PATCH v10 14/27] drivers: firmware: psci: Simplify error path of psci_dt_init() To: Ulf Hansson , "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org Cc: "Raju P . L . S . S . S . N" , Stephen Boyd , Tony Lindgren , Kevin Hilman , Lina Iyer , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20181129174700.16585-1-ulf.hansson@linaro.org> <20181129174700.16585-15-ulf.hansson@linaro.org> From: Daniel Lezcano Message-ID: Date: Wed, 19 Dec 2018 13:08:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181129174700.16585-15-ulf.hansson@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/11/2018 18:46, Ulf Hansson wrote: > 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 Reviewed-by: Daniel Lezcano > --- > > 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 > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog