Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp720682ybm; Tue, 21 May 2019 02:20:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6SQPsQzx1m/9ei9Oo2GUplJLicKiuqK7gX0Iy0NP95Z3GA5pZYkIpEyqR+jYKoHkC46hN X-Received: by 2002:a63:b00e:: with SMTP id h14mr77271490pgf.321.1558430409880; Tue, 21 May 2019 02:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558430409; cv=none; d=google.com; s=arc-20160816; b=UCVRPr4Cnc/OriN5ewrpXr09r6zI8mnFS/8XFIlSWc0gRxUm2EJxpc2VnWXMMzCIR9 mxNq5uriyBfDcJF4XBA/lTqXw+9M50d0vwG1ihoGRHbsi2rPJXFMQUj3iqaQ1kNfaNyx zhm5rP7HFpyjMJfC4jMm287rUrMK6VtHFVHhHQbBi9Egm51i+ViNmVg3v3oHjtAJGFU4 5kdha125EfqxRKntZt1QtBoc89A2OhJp0zQHRuWzEWqbPNBjSuxPIy0L65l8q8fB+PgG o0JSMqe6g23C6UhjMTljaANUfjc0UBzcZh6jlwXbWBVIoknR1uayrfcNzK0XgO84tetQ TY3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=YSzlrVus6h4wgDGfi7rOg2cKnK8z3Gki/jd2MrlQMb4=; b=nJgG9nywOxQ/P+xfkD3aAaPthZkgq3fohG6RwZ5X9qAeT+Kefn/EwKBNbXwDFFnMrw 2s/ixsDb1C7dLEp+lWJtbtOdnD+K7JP2Xx1Ky9RQVf+gQvlMQh0WvYz20eiI0yS/13De eTSqyj+3ACftD4su3IpPop2BvlmvewgH1Xf4mjPteqDa2iGRMK743/LoP0W6nvWt1Tj3 IoUooYPe+UFKIEBITjZQmq8vaoeNJi3XaacCBZCIwiw2x2j4ewtGcImimoh9T70UjuQ2 lHs/vl8iCwpzkTFP0Ey6EIyDGv5ERDFAJChZA6SQvcAtEZgBT7jPWW0yJ3XwZsDS3hql NHsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=gZYCgIsm; 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=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o33si22053662plb.230.2019.05.21.02.19.54; Tue, 21 May 2019 02:20:09 -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=@nxp.com header.s=selector2 header.b=gZYCgIsm; 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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727106AbfEUJSs (ORCPT + 99 others); Tue, 21 May 2019 05:18:48 -0400 Received: from mail-eopbgr70083.outbound.protection.outlook.com ([40.107.7.83]:18693 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726006AbfEUJSr (ORCPT ); Tue, 21 May 2019 05:18:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YSzlrVus6h4wgDGfi7rOg2cKnK8z3Gki/jd2MrlQMb4=; b=gZYCgIsmPgoF3ROdvs/CawdERYiy92dvA8TC2dU8aHz/1T/thRFlMGDkgYy8AjxhnhElYVJj04ouduWHuPTav1tbeeG0V0JBHv1+ro/go4KYb595Cp/LtzCYC9+2nztWBrr74zyNfqPu/Dzx3gxUQA9zPvZb7rpZB0Gt79+I5cU= Received: from DB3PR0402MB3916.eurprd04.prod.outlook.com (52.134.72.18) by DB3PR0402MB3836.eurprd04.prod.outlook.com (52.134.71.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.16; Tue, 21 May 2019 09:18:43 +0000 Received: from DB3PR0402MB3916.eurprd04.prod.outlook.com ([fe80::5835:e874:bd94:fec]) by DB3PR0402MB3916.eurprd04.prod.outlook.com ([fe80::5835:e874:bd94:fec%5]) with mapi id 15.20.1900.020; Tue, 21 May 2019 09:18:43 +0000 From: Anson Huang To: "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , Leonard Crestez , Abel Vesa , "viresh.kumar@linaro.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" CC: dl-linux-imx Subject: [PATCH 1/2] soc: imx: soc-imx8: Avoid unnecessary of_node_put() in error handling Thread-Topic: [PATCH 1/2] soc: imx: soc-imx8: Avoid unnecessary of_node_put() in error handling Thread-Index: AQHVD7YvdNtmZ2uz6UeyYdwfC+FzEA== Date: Tue, 21 May 2019 09:18:43 +0000 Message-ID: <1558430013-18346-1-git-send-email-Anson.Huang@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR0401CA0005.apcprd04.prod.outlook.com (2603:1096:202:2::15) To DB3PR0402MB3916.eurprd04.prod.outlook.com (2603:10a6:8:10::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=anson.huang@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 92db3c01-4687-4cb2-5f4b-08d6ddcd517e x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:DB3PR0402MB3836; x-ms-traffictypediagnostic: DB3PR0402MB3836: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3383; x-forefront-prvs: 0044C17179 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(366004)(376002)(136003)(346002)(396003)(199004)(189003)(4326008)(486006)(256004)(14454004)(26005)(81156014)(8676002)(81166006)(8936002)(6486002)(2201001)(2501003)(6436002)(6512007)(7736002)(86362001)(53936002)(3846002)(36756003)(25786009)(6116002)(71200400001)(71190400001)(4744005)(5660300002)(66066001)(64756008)(66446008)(102836004)(50226002)(52116002)(99286004)(2616005)(66556008)(66476007)(73956011)(66946007)(186003)(476003)(386003)(6506007)(478600001)(2906002)(305945005)(316002)(68736007)(110136005);DIR:OUT;SFP:1101;SCL:1;SRVR:DB3PR0402MB3836;H:DB3PR0402MB3916.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: OhrtVyWcq7jHAm/gdy2b/sT2EbBOqcTHgH1rK2xcPl/eEjGFcNKyAA2LO4ChIj+23ryuYzWlKZiW1Pr29RGjwefSqb7iwimlm9PPH7XKXkA5k+CChNEnb7Dnq+KCgD07QcO1kn9vjyo77Sb67cZpJKvLdoymFVPNdFBtZooHAvgo8hRUpdjX9YSbn1UFrigx/EYIEkdIKc3O9FnrOQaowZbk6mBj7eCM7BGkwe0oESVjUtBWY0LmLev6/UaOolrvYtzBi0d4+NYtfiTN+gmMQuFYAEQllFCxRzD5Twe2LO78Hnwt8k05P2/1VLuuxPJKJ3q6peilEgLCduG6G1xXxJqoHPARCIOmZQmsW3N4s4ht8HNj1FkwVSGf1bo3uqEyAswgWsMP7Ko2lzTeKY1QOiQeghZPR0y/+jcFW1pjggw= Content-Type: text/plain; charset="iso-8859-1" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92db3c01-4687-4cb2-5f4b-08d6ddcd517e X-MS-Exchange-CrossTenant-originalarrivaltime: 21 May 2019 09:18:43.1360 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3836 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 b1bd8e2..944add2 100644 --- a/drivers/soc/imx/soc-imx8.c +++ b/drivers/soc/imx/soc-imx8.c @@ -86,8 +86,6 @@ static int __init imx8_soc_init(void) if (!id) goto free_soc; =20 - of_node_put(root); - data =3D id->data; if (data) { soc_dev_attr->soc_id =3D data->name; @@ -106,6 +104,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); =20 + of_node_put(root); + return 0; =20 free_rev: --=20 2.7.4