Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp24950ybi; Thu, 23 May 2019 22:51:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVB3JfiY9Ok6G09p0hGyyiKI9CQ6/zT/6DNeDA8OPfgJ7RoNwjvLLYGHEAv7hFqxBFxSqy X-Received: by 2002:aa7:9159:: with SMTP id 25mr79122813pfi.64.1558677064829; Thu, 23 May 2019 22:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558677064; cv=none; d=google.com; s=arc-20160816; b=nBZFG8Dw56RcERoVOBLwKGVRTopnTbXEZt57ol5mdrHjxfDSWWGfIlGS3X4uYp1ysN f0Pt/UE2paC16E0h4W+FNyZB2SmmgGISpmOmA+hNZAYZeA2N6gWjfjfi4hzHEi6F8oK3 L8qD7e0lLz1tVlm3yLHZOeB0RrseW4CZ/MTsie8uD49xC/uFiH3NOthfEOGzx0l4m/RO idpOwcQLtr9TZnXw4hODwbgU/2hCkLs6kzBiZ9Pv3DBmxsDAr8b7YL9KcOGjBCWREMrd jQsMBw+WGrhwf0VX2WshtOQwfhZJ4jv1SfAoiWIP8GTLKEH6ivJ35cPX78zoO//ABoEF 9MZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=xeMIhTjzdHLxSPSCQ/QbgyFMeCyArj7Ru4ho5HJdloo=; b=zy+h0rZt154lj/cyZlibeWd32DZIvBoHTbSrzgFKxHbpJEh44AGYFNDBQ7TzRTRNU1 +eCEYvf+oV+3+eFs5PT+BT/bMAZ8u4NjKW5AJ8NpxO8Nx1RQSQP/OGQiFnfANXjAy8gZ ykv6iK30Tod1OGn56HDFUjjRwn6wYVL+UAgO87ip+BpCm+67QnkHKYyYaLfs3r9LF+9J p0/LhY+XkH5vX5Yg+6JG3TkJ2Ogn3FNNvFDAyjbzUxREcUyVN9VR5PaOe7yLA+n3zDq9 6UYBKROgjGCNB0dCDkhYOKN0XCUM3mqkOwj02/16n6nCb480j2A3f2WVXfsCkjlIRpF8 iPtA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si2519092pgv.390.2019.05.23.22.50.45; Thu, 23 May 2019 22:51:04 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388313AbfEXFtR (ORCPT + 99 others); Fri, 24 May 2019 01:49:17 -0400 Received: from inva021.nxp.com ([92.121.34.21]:54862 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388206AbfEXFtR (ORCPT ); Fri, 24 May 2019 01:49:17 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id DC6472000FF; Fri, 24 May 2019 07:49:15 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id F019B2000AC; Fri, 24 May 2019 07:49:10 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 9A1D74029F; Fri, 24 May 2019 13:49:04 +0800 (SGT) From: Anson.Huang@nxp.com To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, leonard.crestez@nxp.com, abel.vesa@nxp.com, viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, hyc.nju@gmail.com Cc: Linux-imx@nxp.com Subject: [PATCH RESEND 1/2] soc: imx: soc-imx8: Avoid unnecessary of_node_put() in error handling Date: Fri, 24 May 2019 13:51:00 +0800 Message-Id: <20190524055101.3424-1-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anson Huang of_node_put() is called after of_match_node() successfully called, then in the following error handling, of_node_put() is called again which is unnecessary, this patch adjusts the location of of_node_put() to avoid such scenario. Signed-off-by: Anson Huang Reviewed-by: Leonard Crestez --- drivers/soc/imx/soc-imx8.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/imx/soc-imx8.c b/drivers/soc/imx/soc-imx8.c index 02988bd..d5badde 100644 --- a/drivers/soc/imx/soc-imx8.c +++ b/drivers/soc/imx/soc-imx8.c @@ -115,8 +115,6 @@ static int __init imx8_soc_init(void) if (!id) goto free_soc; - of_node_put(root); - data = id->data; if (data) { soc_dev_attr->soc_id = data->name; @@ -135,6 +133,8 @@ static int __init imx8_soc_init(void) if (IS_ENABLED(CONFIG_ARM_IMX_CPUFREQ_DT)) platform_device_register_simple("imx-cpufreq-dt", -1, NULL, 0); + of_node_put(root); + return 0; free_rev: -- 2.7.4