From patchwork Fri Sep 25 23:45:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Jordan X-Patchwork-Id: 11801011 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E04916CB for ; Fri, 25 Sep 2020 23:51:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2F57221EC for ; Fri, 25 Sep 2020 23:51:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729495AbgIYXvH (ORCPT ); Fri, 25 Sep 2020 19:51:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729480AbgIYXvH (ORCPT ); Fri, 25 Sep 2020 19:51:07 -0400 X-Greylist: delayed 359 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 25 Sep 2020 16:51:06 PDT Received: from agrajag.zerfleddert.de (agrajag.zerfleddert.de [IPv6:2a01:4f8:bc:1de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F148DC0613CE for ; Fri, 25 Sep 2020 16:51:06 -0700 (PDT) Received: by agrajag.zerfleddert.de (Postfix, from userid 1000) id 293B55B2095A; Sat, 26 Sep 2020 01:45:04 +0200 (CEST) Date: Sat, 26 Sep 2020 01:45:04 +0200 From: Tobias Jordan To: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andy Gross , Bjorn Andersson , Linus Walleij Subject: [PATCH] bus: qcom: ebi2: fix device node iterator leak Message-ID: <20200925234504.GA18813@agrajag.zerfleddert.de> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In the for_each_available_child_of_node loop of qcom_ebi2_probe, add a call to of_node_put to avoid leaking the iterator if we bail out. Fixes: 335a12754808 ("bus: qcom: add EBI2 driver") Signed-off-by: Tobias Jordan Reviewed-by: Linus Walleij --- drivers/bus/qcom-ebi2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/bus/qcom-ebi2.c b/drivers/bus/qcom-ebi2.c index 03ddcf426887..0b8f53a688b8 100644 --- a/drivers/bus/qcom-ebi2.c +++ b/drivers/bus/qcom-ebi2.c @@ -353,8 +353,10 @@ static int qcom_ebi2_probe(struct platform_device *pdev) /* Figure out the chipselect */ ret = of_property_read_u32(child, "reg", &csindex); - if (ret) + if (ret) { + of_node_put(child); return ret; + } if (csindex > 5) { dev_err(dev,