Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp434990pxj; Thu, 20 May 2021 12:49:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxEsWm5yIWaln7EBSUxpG49MnssOxrga9NNpoiYU9ZSJAbHtwjU/Zh7MlWh9QSruP5xGgQ X-Received: by 2002:a05:6402:3548:: with SMTP id f8mr6572839edd.251.1621540195944; Thu, 20 May 2021 12:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621540195; cv=none; d=google.com; s=arc-20160816; b=aK0VrOlB/ZVH5dLJXdOA+/prlH9JhaZ5o9o0NKL8f7dG9i5HGzMPxrXVmUKWzzww21 wbuNdEBSGz2kCCHw+qohUY6lSyG3gEkgbZsnhoUbs/nljAQZjFH0YK8v1zxzkx/gRSqH hLaYhqh+A0Y3V/n/ESBI1+h7ySaWJvLUMttsQmW29VFd1w66MPQSUROpwkXL4SJS9mWe Xe0IiMV4BOEKtWiaKsxY0fqmtmEoRU6tphYaj0a8RXOQjdbyCJX4hb0typUdCq32shiq 1VRcap2P0V/qwCVHKXYIpCpSgQGeTlizHMVo+YI0ky6/IK8GQWu1P0hLCcq5gD91pprx QIdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e/rXVo4Gn/j30Em/IQm2VVJ5EFCWLao2iLc3WEf+XBQ=; b=WKh5fgycJBCMNiUrr58Lcfn/EOzh2WyVtDMG1KHnvtly3HY0N8gxYITJ4TjgNH6oIy 5M9AM4w77s6I98musCeBl82RKTF8MmzG6ft9V7m9cp3mcOLu3hUsVCHFlLiFgWtBmXDq 0ulS2GrKoa3izYWaRCHot/sCDExrXIfnKcM4TxP/qi6se0yGp+5bKM6BBbwHtPyQO86m ocHO9YatfID6ryQmxO6WdMdpzQHyS11ANZk/DQ+Nb2LKzjqTJTJO5+ui8Ywzx6DBMsRT tUgHq6y6j98j0S0eYG36j1uAvRNR8kxRJrKT6Q1BWJvAa9cw8QpNPct0nxL5wJU/90Uk hOQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uPVESW81; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si387842edh.24.2021.05.20.12.49.32; Thu, 20 May 2021 12:49:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uPVESW81; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236188AbhETKoC (ORCPT + 99 others); Thu, 20 May 2021 06:44:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:55738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235683AbhETK2C (ORCPT ); Thu, 20 May 2021 06:28:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2036361492; Thu, 20 May 2021 09:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504248; bh=wuEv9uLP2+8BvOM9r0lSZMHS1SSZLXzGGyT9AoTcsCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uPVESW81hd3oikIZVOIAC847scCFTBwzXlEcO4tvKSkzQDssdxxlTwg4hRk+pgrFF 55wW+gx/6PszULNsv3ZDxqmp/hbD7jdBF0zKaQGlTVzNtFGItgr80s7fqaILVa4zPY s/lbVHAP3e7/lWf6DakphJxbfZA34U/tGP3auOmU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Pan Bian , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.14 158/323] bus: qcom: Put child node before return Date: Thu, 20 May 2021 11:20:50 +0200 Message-Id: <20210520092125.515547331@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pan Bian [ Upstream commit ac6ad7c2a862d682bb584a4bc904d89fa7721af8 ] Put child node before return to fix potential reference count leak. Generally, the reference count of child is incremented and decremented automatically in the macro for_each_available_child_of_node() and should be decremented manually if the loop is broken in loop body. Reviewed-by: Linus Walleij Fixes: 335a12754808 ("bus: qcom: add EBI2 driver") Signed-off-by: Pan Bian Link: https://lore.kernel.org/r/20210121114907.109267-1-bianpan2016@163.com Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- 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 a6444244c411..bfb67aa00bec 100644 --- a/drivers/bus/qcom-ebi2.c +++ b/drivers/bus/qcom-ebi2.c @@ -357,8 +357,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, -- 2.30.2