From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4EBCC73C46 for ; Tue, 9 Jul 2019 17:57:29 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B22FC20651 for ; Tue, 9 Jul 2019 17:57:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="J32Kj0gf"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kH2Xr5PK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B22FC20651 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject: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=+FmWuacmJXBmXjM4/wI3J94/y9BLRnRilaS2GFMqUec=; b=J32Kj0gfQGW/L3 5+Gr6slfEat6Jlazl+xL/ngSDeSJMg1sLKtEgxOkV06/j2x77JD7JRC5gimLm5XfDWVHGyA6dN12e dQLYcentuAELPQyMx/7WHRDWFcqCJgn2lcFSyIGcz4o30s2HDqq9P4/IZAwXtmWZS9Dsb9lT8RDj6 CWiQo5ECMXcqlQUIorVm8Z/1iCMAAX6WTVUhXSdd6YMCKD19Bl3/9PdscyU7I5HcgFEw78VdIQ7Bn LfKIwaFOkzcsQLTunsgccOK8GWbXE2LP0+oIH9mVPRLuAvCIQgordGnsRvuKPyHdnT4QF1tW3Y5P9 aVZi4a0m3tBXt20ODFUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hkuMo-0005nT-Qp; Tue, 09 Jul 2019 17:57:26 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hkuMm-0005n4-Ki for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2019 17:57:25 +0000 Received: by mail-pf1-x443.google.com with SMTP id r1so9638939pfq.12 for ; Tue, 09 Jul 2019 10:57:23 -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=qkTnc9KFxu+eKkMI+ViyuqAH2l9mhes3oVPetOo6UQY=; b=kH2Xr5PKkvPiBIbtnj6MZx5BcJmwSCNPYlmSZPff6YRpV0M6JyGSKFG8UWWWGWc68e n6Re9PfR00VnhBuO4KV2ZMBLOnvhp/y4eFcficbncQiSTjlvCqFxFxdS7yQRdqoM9um1 zefV9DGAXCSHUQsC8X7HKP2XKi8Ba+N+qHGt9g+erWPn7qLebacUdK42msZuFco6ScDg herty0K+BB91hoFzHBDw0P1SYh7wdS+1Mjhg+H0TkpPGDMPmIx49xaQMYzcfV52B+/G0 uFOwQDbqMH8XDDffSwYoK//U10bYjw1Q6h8nqOXqSLfijDVD3dGqItfIf5X/OVt5VHWf HoGA== 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=qkTnc9KFxu+eKkMI+ViyuqAH2l9mhes3oVPetOo6UQY=; b=bJPYfQidiAwuZVIgh8gSScIpJHRmXqDvdP4xJA+VATKKNmgajAxBZmfVhnifVqlgOz ISGpFP4+i6B9C5h1d48/jy65mnK405SMo2jT0WhpFc6vRIKFJPUY13AQG75fwm2jjsoF iuZv4RVzsRmx86Pn0dXYaDhNbf53xIKB5lPBzCEML4quc0HIOjziUXHelcuCilwyxrMF D34pp4dvUrfxL9y5ydjvafCwQRIxaMR0WKPHMcartqPpkBc3AlvittRbM5hadnq76aec xkqAsCOym9OCigJYhn0vRK5dz6KQV0Vd9XI6Slj54e092a2SOguCKTKuzySfjG0RYORz ZEJw== X-Gm-Message-State: APjAAAXHnl2I+Sfw8BB99QwBy3RkeDlHHFPAKCsCBkNTFB5OESU1Uq4O fK6Hxtzc4SKKbSsV2ghPxYGUGD+C X-Google-Smtp-Source: APXvYqyHEj1ycd0OwQ4OuYIRtHZp+tj2PbBPUkVMBjOFdxSPMPV6yLypN53LzZ+IKw5gtq9D2WzA0A== X-Received: by 2002:a65:47c1:: with SMTP id f1mr31464882pgs.169.1562695043418; Tue, 09 Jul 2019 10:57:23 -0700 (PDT) Received: from localhost.localdomain ([110.227.64.207]) by smtp.gmail.com with ESMTPSA id o24sm20051491pfp.135.2019.07.09.10.57.19 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 09 Jul 2019 10:57:22 -0700 (PDT) From: Nishka Dasgupta To: hdegoede@redhat.com, dmitry.torokhov@gmail.com, maxime.ripard@bootlin.com, wens@csie.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] input: keyboard: sun4i-lradc-keys: Add of_node_put() before return Date: Tue, 9 Jul 2019 23:27:07 +0530 Message-Id: <20190709175707.14278-1-nishkadg.linux@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190709_105724_682053_E6224AA7 X-CRM114-Status: GOOD ( 10.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nishka Dasgupta Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 in three places. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta --- drivers/input/keyboard/sun4i-lradc-keys.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c index 6ffdc26b9c89..4a796bed48ac 100644 --- a/drivers/input/keyboard/sun4i-lradc-keys.c +++ b/drivers/input/keyboard/sun4i-lradc-keys.c @@ -198,18 +198,21 @@ static int sun4i_lradc_load_dt_keymap(struct device *dev, error = of_property_read_u32(pp, "channel", &channel); if (error || channel != 0) { dev_err(dev, "%pOFn: Inval channel prop\n", pp); + of_node_put(pp); return -EINVAL; } error = of_property_read_u32(pp, "voltage", &map->voltage); if (error) { dev_err(dev, "%pOFn: Inval voltage prop\n", pp); + of_node_put(pp); return -EINVAL; } error = of_property_read_u32(pp, "linux,code", &map->keycode); if (error) { dev_err(dev, "%pOFn: Inval linux,code prop\n", pp); + of_node_put(pp); return -EINVAL; } -- 2.19.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel