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=-8.0 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,URIBL_BLOCKED,USER_AGENT_SANE_1 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 98006C742A5 for ; Fri, 12 Jul 2019 06:50:19 +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 66C3B20863 for ; Fri, 12 Jul 2019 06:50:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="du12LuuD"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uIglaz3J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66C3B20863 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fWWhxvXxNPS0bWbq0I8/uD9tCoOj4gKBaUuFS3vPHpM=; b=du12LuuD09Wpu1 Z0x6KOGwQRTrI/v77Wf8ShWppJO0YLSgpjlWHL9fa7oMN7og6fMXhkhb1mYlVYrHLyR8oz2bK2bt+ SGr3TiPp1IrzjbinhjH5zdMPSsJ5qITL6VweAWi2NDMjVALPEq9xd9S68eLYRoHoi9NZeKALgwmzN Qkg6j+RHcOV88GG9s9UKuiHRuffRp6XJqrqKwGYJGlbSJELbW7g+39OV+eNxmeIIGOJ1yJdQE+AtS RZKsU3J6sTJXZQElqro/wM+dGb6bbNKmr28Qvhf3a6EfsLic+f1ZQNSjTbhPXfWTCZM+JtFoaIOD3 IRQCzoY45jOWlPyWSH9A==; 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 1hlpNq-0006o4-2h; Fri, 12 Jul 2019 06:50:18 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hlpNm-0006nb-RZ for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2019 06:50:16 +0000 Received: by mail-pg1-x544.google.com with SMTP id z75so4093811pgz.5 for ; Thu, 11 Jul 2019 23:50:12 -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:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CfCP6AM+q26Tk6D03k1iE3+elCvT4lB1HPpCLmqktB0=; b=uIglaz3JhPuRKxPH+jBqVn6oInErsfOz7ggSmmU9JE0y/0mbUj9Xo+hq1SWo9mplfU k/yTkbNxLpSTYYjGxxhwcq8PVC5CAJsqITVvzsR4uHKfe4XGxDMNlhd+zQLkkU01cNur vd9k9AQLM84lJLuoQF2D9SWc7ZjaJ5ryEC1rg7foUH8rpuW/sFJbd/V+CTo+AAHIABbX ukOj2Ls3scyFYPiuRGmYRbCAlszJ0iIDZfkhEizxvd2q405n73cYeS5vOVYk8DmT7HpF lt38mbuLCFz9f+FL213Dop9lhhCL5/l99rU9+v7KMqnvzWYz0bpTJJEuTRkCUwCyw+u/ 7mhA== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CfCP6AM+q26Tk6D03k1iE3+elCvT4lB1HPpCLmqktB0=; b=fZROPuDUXfFdX/+q7rG6nS7YOcyCuWIdgL7pUODHyvJo46pjY12S0YYl1bTmoh3tJi DhMmcKgjJOdeboVdmoSgbJKzFBPY7EeV8THclXaAnGoaWI0M7riBHfzSI/IKh/yPIPvD ccFKkPaTxBkor1tCPplhXd4HWRCTWIZn+8wrOR4L1U2nUMaJ3JAJc9GKznnLsONwFlA0 sjfaWOjoxlTeFuy5A+rN0a9DHopbMWRBPunj4ViDQrgqmIWVuk0pd0N8DSEGC41xAMPR +Yyg7TTaeaYx9FOosu70OOKTCw26RUdCJwN/cMNjQGGPQ7lXBVoUz/EbwilCQXgYykgo 9dRA== X-Gm-Message-State: APjAAAWiRVFTXnwKCVIAMHU+HdiE12/oEL+ICwlW6CYHJkAnDpqBQQTQ 3+QJluiNAsbEzMTJL7+8Rz4= X-Google-Smtp-Source: APXvYqz/Ozc/pWGLJdSYhomnv0SNHeqaJCrHX5Twx6PhMiDoGboYFAkwhRjAtONTxzxoldIegoP/aA== X-Received: by 2002:a17:90a:1b48:: with SMTP id q66mr9313016pjq.83.1562914211991; Thu, 11 Jul 2019 23:50:11 -0700 (PDT) Received: from dtor-ws ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id 25sm7372302pfp.76.2019.07.11.23.50.11 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 11 Jul 2019 23:50:11 -0700 (PDT) Date: Thu, 11 Jul 2019 23:50:09 -0700 From: Dmitry Torokhov To: Nishka Dasgupta Subject: Re: [PATCH] input: keyboard: sun4i-lradc-keys: Add of_node_put() before return Message-ID: <20190712065009.GE150689@dtor-ws> References: <20190709175707.14278-1-nishkadg.linux@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190709175707.14278-1-nishkadg.linux@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190711_235015_349295_F21C03EB X-CRM114-Status: GOOD ( 14.88 ) 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: maxime.ripard@bootlin.com, hdegoede@redhat.com, wens@csie.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org 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 On Tue, Jul 09, 2019 at 11:27:07PM +0530, Nishka Dasgupta wrote: > 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 Applied, thank you. > --- > 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 > -- Dmitry _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel