From patchwork Sun Aug 4 16:02:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishka Dasgupta X-Patchwork-Id: 11074787 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DBB7014DB for ; Sun, 4 Aug 2019 16:02:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF1DA287F5 for ; Sun, 4 Aug 2019 16:02:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A29128800; Sun, 4 Aug 2019 16:02:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84280287F5 for ; Sun, 4 Aug 2019 16:02:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726474AbfHDQCQ (ORCPT ); Sun, 4 Aug 2019 12:02:16 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43476 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbfHDQCQ (ORCPT ); Sun, 4 Aug 2019 12:02:16 -0400 Received: by mail-pf1-f194.google.com with SMTP id i189so38352822pfg.10; Sun, 04 Aug 2019 09:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LeGjYEzEnNd+LP7E7X1hGpTj7PNVozz8mf2RHENRFPs=; b=LQytGn6C2tlkbNTMXkKZ2UyVakSPWDuBvnr2zYpndh4VptsQvTykzeffX86XeALTgk u8V7q4xuIO4nY1eainybsqRRCkUU9UZlaffx/Mex4LR1mcNDxNllViZbEwkZoTaK522W wNmbSEB1xFONhovQ+m5fvb60LMQaLRZo0Rr3nclUoBwKBFLotbBQx8P+D4Hk6VSSomcf uAFJYT+MpMD/OhRYnG2IH5A9GbIq8Y8dH6GuknoM6u4uPRzsp2pZ8WQGQtUqzKdk/t6M QjVvRlovZa8Le8dedeV0qILbbCFLc6E1OaiO2i3+6DMhS2WVshgPVhzxMovkkd/M6ZvF JLRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LeGjYEzEnNd+LP7E7X1hGpTj7PNVozz8mf2RHENRFPs=; b=PD5ynfU3IeMCj/tcRyvhTb9wGKy0ykxbNom1SsdQFKS2pz0xQ/9GUnC1OssuKIy8AO TAqOgOneBGyjqbG1rdO3xfBqODftMx7+z2AU8XlDuF1GtJWzX1SaPOq/P6rbur2NEyMl LZJ95bK/e0H1QnnIqzeQKRaB+5wjAghpKSva2CxWe7CprM6RBhC6tBwHt2uU3fnklnG2 ae202rmIoFISV59CiUJuLhHh6Nn7fhlsj7Lt67L2XDNBX4dy7PzRTnHOgAZyIHik/ZqI OUBlHmRtJ5nb7ObNT4+zhYvAICTUqmrgxPRiZS1L0N21aQmctyFqrBjlVGArMLEHvPej RG6g== X-Gm-Message-State: APjAAAU/+YMUgkq4aat4D+01ctaT63gYI5eBtiZGpUjC+3lSrpn5gKwX FTznCG53W10qI1chrJ/o4fg= X-Google-Smtp-Source: APXvYqyW3HshrRKiqWhhL7Xm0gBHnBObsgshWMul17uZfpv0UekHsFJKsZHv4yQsC3HGKCgiksvnzA== X-Received: by 2002:a63:89c2:: with SMTP id v185mr27001405pgd.241.1564934535868; Sun, 04 Aug 2019 09:02:15 -0700 (PDT) Received: from localhost.localdomain ([122.163.105.8]) by smtp.gmail.com with ESMTPSA id v22sm80865042pgk.69.2019.08.04.09.02.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 04 Aug 2019 09:02:15 -0700 (PDT) From: Nishka Dasgupta To: linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, tomasz.figa@gmail.com, krzk@kernel.org, s.nawrocki@samsung.com, kgene@kernel.org, linux-samsung-soc@vger.kernel.org Cc: Nishka Dasgupta Subject: [PATCH] pinctrl: samsung: exynos: Add of_node_put() before return Date: Sun, 4 Aug 2019 21:32:00 +0530 Message-Id: <20190804160200.5139-1-nishkadg.linux@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Each iteration of for_each_child_of_node puts the previous node, but in the case of a return from the middle of the loop, there is no put, thus causing a memory leak. Hence add an of_node_put before the return. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta --- drivers/pinctrl/samsung/pinctrl-exynos.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index ebc27b06718c..e7f4cbad2c92 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -486,8 +486,10 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d) if (match) { irq_chip = kmemdup(match->data, sizeof(*irq_chip), GFP_KERNEL); - if (!irq_chip) + if (!irq_chip) { + of_node_put(np); return -ENOMEM; + } wkup_np = np; break; }