Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp2005932pxa; Sat, 29 Aug 2020 10:44:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/o20s2vY58N49Ks/3VBOQtIwX+LOB12xryhq2bIlDafLPYUi5PGLJLIC3/nLTx4wCD/Iv X-Received: by 2002:a17:906:71c7:: with SMTP id i7mr4266235ejk.245.1598723048156; Sat, 29 Aug 2020 10:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598723048; cv=none; d=google.com; s=arc-20160816; b=WHkgWZm97V0djx6tSxdqgGTC3zuUVC32/IUD8/O7ySnVbvWi7sDkh9M8/bujgoBn4+ 6UQPJNB6vLTCO4avRfASu0NiUuomlJTugN3MPX2GHgRneUNl4bnNlrbLgrbIwuFLe0Ox eIEBPs1lh8PrK66ZRSC/8cU8QpObIdLHAly8okmu3XPU5r21fVot2TfMpOYXFWw0oKQZ drqOfH2t/zBO4ywASL0GW1mu2QqjtFRSSWsbW94MTKpPhovXbDm5QqEsCHTaMxPx4gEx FoBz54Dke0Qz9OOAY1oDRRo7DLNZzMnElWYRSyzCcqIcdcFcUejI8gapYK4Tuth2CC9/ jdqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=v0+Y6jCCh/wg/QF1vN3peVwswvjJOdtClUaEODnQziQ=; b=gxpsoGP/Ie3zsUijplUO0DfhOetdPvHbLcwH7F//+S1TZXloGNA30r0akuLdfhPSD3 aDVtuwyZbgT/8JMoUoR92QwDowBTsZLNK57591r80eXOOxvYphYxShwenILejUje0/P9 CJQekhtNiTP9up1X6oS2eXYLRWM0OJsi8TL+bHlC8Uwv/PwzJPGXlHpq1s14YjQaSvP4 uDqGa4J8Ipj+HcWBgTj2Ge4B7QOCXeRZsd+eUivtQaeyvV5/6z3uGaDMarXUX3K8N9kX zmPcyzRsvKucohb01IakMlFnA/fk6Zgkqe2fpoA12fpbBh/S4PIsOw1Q7KYQfuj820k4 4eBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oFeXjVAw; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gs14si2138924ejb.615.2020.08.29.10.43.42; Sat, 29 Aug 2020 10:44:08 -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=@gmail.com header.s=20161025 header.b=oFeXjVAw; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728254AbgH2RmD (ORCPT + 99 others); Sat, 29 Aug 2020 13:42:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728203AbgH2RmB (ORCPT ); Sat, 29 Aug 2020 13:42:01 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B32DC061236 for ; Sat, 29 Aug 2020 10:42:00 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id o13so2020715pgf.0 for ; Sat, 29 Aug 2020 10:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=v0+Y6jCCh/wg/QF1vN3peVwswvjJOdtClUaEODnQziQ=; b=oFeXjVAwrSsrDiXpvBkVKLGo4tCbl62Epz1MfOQSMzS8sQ6rpl2LHbpf/pQq8W68mC oTXIz5IQSy+EQf0kdwftqhfFFh4lXPXhC7TW9KKsqNv3gNfnaPMmIsEjiJKHbaCsndiS J53uLYxbt1mSOX0QfeA42tgjzAG9wd3btizSgcxC4Zd+NAa50m8bjfN1sIApgbPKmBkP G2HWgkjKHYzz8YWNos6xicICQj6D9a0Z5ihabi9rZZ9m9uZmEGpRsmaJL6gFqNenxINY Z8M2DPOjASl+gtr670VNie794YqbKioyR9WjY0Cp+03P0bdbv7stfoBESWNHvc8GSQ1c 5sUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=v0+Y6jCCh/wg/QF1vN3peVwswvjJOdtClUaEODnQziQ=; b=eDal+wpGI62BPk2GUcifq4ytkz61rzOLtO8LpS0d3z03/f3yFQzyEXw5xgxqzMr0PE 2bySLPUBHHR9k66DaW80oIehCMhNuZTLBZ89E2usgoVhPMHpbrzGj8srVkJFqh5sIXQ7 jTy+Q89JcU5eCFeW1Q0xCjwul6NU+45kTjwPqB62lR7C1MhS43cJDUSwL9b3Iqgtj7CI ZF5+kpTU2JOmGEWUidb3MtMfeuRJqrMFRtg8Lzk7oSPMSa1qpOZ2ukCpw3oaaQiwdufw tdGo0UxdDGSUdxxlHH/mrBNo7UrmbmD6uN/14N7Si+XCqtXnEoU9/pIaqqaTp0+x+6DO uc+Q== X-Gm-Message-State: AOAM530p58qFivBWJsdgzWDHGISqU8mkV5EkPg6IINGjB6hU4TqUMIBi 9IR8igaisgSHj80ExNOUd68= X-Received: by 2002:a63:1341:: with SMTP id 1mr3110890pgt.144.1598722919806; Sat, 29 Aug 2020 10:41:59 -0700 (PDT) Received: from Kaladin ([49.207.221.164]) by smtp.gmail.com with ESMTPSA id u2sm2591711pjj.57.2020.08.29.10.41.57 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 29 Aug 2020 10:41:59 -0700 (PDT) Date: Sat, 29 Aug 2020 23:11:54 +0530 From: Sumera Priyadarsini To: linus.walleij@linaro.org Cc: Julia.Lawall@lip6.fr, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] bus: arm-integrator-lm: Add of_node_put() before return statement Message-ID: <20200829174154.GA9319@Kaladin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Every iteration of for_each_available_child_of_node() decrements the reference count of the previous node, however when control is transferred from the middle of the loop, as in the case of a return or break or goto, there is no decrement thus ultimately resulting in a memory leak. Fix a potential memory leak in arm-integrator-lm.c by inserting of_node_put() before a return statement. Issue found with Coccinelle. Signed-off-by: Sumera Priyadarsini --- drivers/bus/arm-integrator-lm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/arm-integrator-lm.c b/drivers/bus/arm-integrator-lm.c index 845b6c43fef8..2344d560b144 100644 --- a/drivers/bus/arm-integrator-lm.c +++ b/drivers/bus/arm-integrator-lm.c @@ -54,6 +54,7 @@ static int integrator_lm_populate(int num, struct device *dev) ret = of_platform_default_populate(child, NULL, dev); if (ret) { dev_err(dev, "failed to populate module\n"); + of_node_put(child); return ret; } } -- 2.17.1