From patchwork Thu Jul 6 07:13:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lu Hongfei X-Patchwork-Id: 13303240 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E6C3FEB64D9 for ; Thu, 6 Jul 2023 07:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=+CzG1LqiDwrWz0KifBju8ESCPgmSIOVbfQwaMDAzM1E=; b=VJXvs+ss0MuPcR Gm3lPIUHb/mLfLpSEmxo4bgyGw0am8l+lfcWDp2QgcImfIz/55rDAIvS4T5c9QfCSe35ZmDv73lEv yju5vFf3cXoO5na2ninG0Qr2sdrCCJwntf2zOzAoWfBryiS3vC4xqlI7ubj6vJtCfYrzDB3mZyz9B kU1Q9E+UPqTZnyo183Xty5E3HUvKpNPSsYdQXYL0gabhzJK4f6ToTX8LrdBeDI3Cr8dyZzerc3oIT nWTvIN7PiXBP4DMmCq6tslfMANpCXknnEONOjEwF2q8/vH3fnEY7cdqtoO29exyFbM4rJVvG913CM GqoxhNJ9lFpm1n+i+Ovw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qHJBO-000kjF-3B; Thu, 06 Jul 2023 07:13:42 +0000 Received: from mail-psaapc01on20725.outbound.protection.outlook.com ([2a01:111:f400:feae::725] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qHJBL-000kiW-33 for linux-arm-kernel@lists.infradead.org; Thu, 06 Jul 2023 07:13:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HLnifU2sykmqn4mxX7dt0gOQzSfk2ddNkyPHB5tw3jq0pwe6qLcHMA1GKp48hMduzzyhTkNzuIpTsZJemTgiwozJ2g31Yt+hfz8yIomkq6XLkjYJUUjI/dpnyLm3BbjcQT/vHuf4UrelF+9hHGQh5sYoku3YrVTU48Q5UPEZ/ptISL87QgvUG+EmqW5m2tdm2yLclVZOQMIsq7HiGZ7+rYBxCFO+dORBaZZTGu0bgJ62SJ/O3qg8LFgHPu3I4TGN3AgnXIBlmsqIF3iWdREL3Y+CYCYb31sMgy3Ed4Az+KKoqsiTX5y0uPoHHVkmwQ2wgjOpRHaySQPQlU7DeU47yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BpH/A+pMSvFwqC8zTUhORJh+p6mJYDWQhhj2dalE2IU=; b=TyxLHPm/2peUIWSyMLSBjRk1P2lBom8QyhNWy35fUI2i9CKbJo3MMLdmH7BucbzKZTJWEBFbZRyqYK1ppmZn8Z10bP3+snsCw+9xLiGtDXy7hgrd3f4O6b62gh/2pwu024RCJEOMVmyHjyAEZXNdRdjomG1TBrntTJU32ztAhBfNFe6qMfsBEmUaMKHtuuS6Cq5TLcEvFsSpAcCr762S8hzjI0tk+HLTNiG3BQ4vrlwBkK/I/M3I/CcfYqkTKnLcuuyWxWUoMd/9dEwwmTGcfufqYg7RAmJ8nHRBpJBTlZI0noMZrmUOAJmapt2h1T/NE9cy9GpilyCt8pT2rIQ8Cw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BpH/A+pMSvFwqC8zTUhORJh+p6mJYDWQhhj2dalE2IU=; b=CrbfX8k38SdKzhtV1Irid465n/S8RYGJ9za4fklnW6iDbQJjCyDCVH3u6mU1Ikl1LyhhPHuQSJqtqIVCas+XbMuEJzufrYj6x+3Ow/0pTQXTWQZC7ktenWWe+WM4ZoIjSd/J+Z4J49u4/lGXdM8tEvF+OqFVRFFcI40fqTQ51hGp4Xbz7uCMpZOAZypPzpTYTnaUHDvchcnLABMx1H6V7gKlR2DIxyvYpLgISWB4UfUpjR0AuL3u/SOFXOdKFzHVau4AXzxmY8vVyuJNGTbhxTj4SP31ZNfMz4Rhz7azCT0U7p4UQLlS9NRoMRrtejFBtJqaTLnu3kXiH0DGJOkJsA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB6697.apcprd06.prod.outlook.com (2603:1096:400:451::6) by TYZPR06MB6021.apcprd06.prod.outlook.com (2603:1096:400:336::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Thu, 6 Jul 2023 07:13:20 +0000 Received: from TYZPR06MB6697.apcprd06.prod.outlook.com ([fe80::8586:be41:eaad:7c03]) by TYZPR06MB6697.apcprd06.prod.outlook.com ([fe80::8586:be41:eaad:7c03%7]) with mapi id 15.20.6544.024; Thu, 6 Jul 2023 07:13:20 +0000 From: Lu Hongfei To: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rob Herring , Mark Brown , Saravana Kannan , Ivan Bornyakov , Lu Hongfei , Geert Uytterhoeven , Minghao Chi , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com Subject: [PATCH] drivers: bus: Fix resource leaks in for_each_available_child_of_node loop Date: Thu, 6 Jul 2023 15:13:09 +0800 Message-Id: <20230706071310.38388-1-luhongfei@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: TYCP286CA0326.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3b7::10) To TYZPR06MB6697.apcprd06.prod.outlook.com (2603:1096:400:451::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB6697:EE_|TYZPR06MB6021:EE_ X-MS-Office365-Filtering-Correlation-Id: f8d296a5-78e0-4927-11a4-08db7df07aad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aHVOKaJVwd6QRaSCzC6AtRgY60mlZFmFXTxVz90LfmJsK7ZoQHHTfxnFiw+k79IJ8DEmtPRboP930HIoOhIXiDZ2SUkGeOLI3jfuZesqkwG+rMH6qhwS8XlR8B/ioTOY4bgGa4wp52+iQdNyaT6Nz36kUWCWdPRLeM7v2Z+ASjRsN995QOKxcrk/8iE49+lQ6NAMWdCIeCw2UvsZpjnesL4OxFtG9nOoAMU0h3kaPPQ7bqLbJRkfa71PP6MmB4ddJAOIDrf0MKOIJkQygZcElgJL+HNSRIkadOM71PvZmeObj/SkNNspFmLdjGBywFk6NksuTjHFcMmjEbCe2gLAJP4tSELqhdFVtWiKlBwBRFP0r8BhaDKzWY+Xv5mt/Br991JceUKgHfX/+uCn1eNdZeqoBp8T0EMHHVtWhMBEC1vslq6OCXjpTTyRxf06blV+D0f3swIjQZJWk7g9AYLnE8oEuXRwyAalQqwnJ0rzWa2CeZLyLM2gaVmygLG+chdNwnQXDh9gPjYkbUAjmIPAjrUKRmFAoTMEnJTz22dix4PAWYCzmPW5xrLm9z/aoc/IFMDlo1AqsexY0U8bXrH1VN+YSn/eUtCVfM3Hy9kyJ9F646fXOSf47uVyl3/ZxTRr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB6697.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(451199021)(4744005)(2906002)(41300700001)(8936002)(5660300002)(8676002)(7416002)(36756003)(107886003)(186003)(2616005)(26005)(478600001)(6512007)(6506007)(1076003)(6666004)(52116002)(6486002)(86362001)(316002)(4326008)(66476007)(66946007)(66556008)(38350700002)(38100700002)(110136005)(921005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LfSBWQnEdoummb/F7Zankx2tmuR1yZwps3epoSx57omlzu1KFe2Y8DbRDQl0kdz3hsxIBcvBGd6lf/+gG8e47RRqbqK58SJWR99tcelEjTGJuFF+4v/Y/FOQ5wMAFpYFce+PNzVUtt4VsinE5c6z4Xms5bMQ3rSpnkAy/VSuRztzaOueBjgg+zUaUcSah7ORPfz0f1wp5xzxJpicx41QqrWGhegHfx8Xed9QeEI7E1GtwhRpQ2YLH4x1PIw9a2aSYWq3+CYomCh1f/Glzt1BojAOSklxW7LgYCzCLajj/dThT8ESmE35tAT3vh/1bEyj4FNqtU3LwcSI6gdpdd/gZYlZlzFtvmxtIE0/aTifaBcEX2XBvcO9dUEojiiVwHPwzEt192AzrCyZd6VmzcwpGC0WquzyKKjpCOfNptsryOB957elt/tUsYQNWug8qq+fY3azOof6eMYglmSy0IQRimxzDQejzCD7MjRihwgO9CE3EUpzgjVLrctAiTYzvImoZ9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BCA4oxzC X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f8d296a5-78e0-4927-11a4-08db7df07aad X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB6697.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2023 07:13:20.9015 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MPAnr5+6eG6ALIOFxOsHDfq1ko/SygH6JRSPaqcTo3BFcTnypoTALzZWTiPukzVpRUMt4pl5CXK8U13KJDA0wg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6021 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230706_001340_010357_0C55C323 X-CRM114-Status: UNSURE ( 8.99 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Ensure child node references are decremented properly in the error path. Signed-off-by: Lu Hongfei --- drivers/bus/imx-weim.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c index 52a5d0447390..d05472f7c20f 100644 --- a/drivers/bus/imx-weim.c +++ b/drivers/bus/imx-weim.c @@ -251,6 +251,7 @@ static int weim_parse_dt(struct platform_device *pdev) else have_child = 1; } + of_node_put(child); if (have_child) ret = of_platform_default_populate(pdev->dev.of_node,