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.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, 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 247BDC76188 for ; Mon, 22 Jul 2019 10:26:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBF842190D for ; Mon, 22 Jul 2019 10:26:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729623AbfGVK0N (ORCPT ); Mon, 22 Jul 2019 06:26:13 -0400 Received: from foss.arm.com ([217.140.110.172]:35182 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbfGVK0N (ORCPT ); Mon, 22 Jul 2019 06:26:13 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6B0FD28; Mon, 22 Jul 2019 03:26:12 -0700 (PDT) Received: from [10.1.196.133] (e112269-lin.cambridge.arm.com [10.1.196.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0D4AE3F71A; Mon, 22 Jul 2019 03:26:10 -0700 (PDT) Subject: Re: [PATCH] rqchip/stm32: Remove unneeded call to kfree To: Hariprasad Kelam , Thomas Gleixner , Jason Cooper , Marc Zyngier , Maxime Coquelin , Alexandre Torgue , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org References: <20190719184606.GA4701@hari-Inspiron-1545> From: Steven Price Message-ID: <1d9aa4be-4da2-b532-4787-c98869c0bd9d@arm.com> Date: Mon, 22 Jul 2019 11:26:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190719184606.GA4701@hari-Inspiron-1545> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/07/2019 19:46, Hariprasad Kelam wrote: > Memory allocated by devm_ alloc will be freed upon device detachment. So > we may not require free memory. > > Signed-off-by: Hariprasad Kelam > --- > drivers/irqchip/irq-stm32-exti.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c > index e00f2fa..46ec0af 100644 > --- a/drivers/irqchip/irq-stm32-exti.c > +++ b/drivers/irqchip/irq-stm32-exti.c > @@ -779,8 +779,6 @@ static int __init stm32_exti_init(const struct stm32_exti_drv_data *drv_data, > irq_domain_remove(domain); > out_unmap: > iounmap(host_data->base); > - kfree(host_data->chips_data); > - kfree(host_data); In the commit this is based on these variables are not allocated using a devm_ alloc function: $ git show e00f2fa | grep -A12 *stm32_exti_host_init > stm32_exti_host_data *stm32_exti_host_init(const struct stm32_exti_drv_data *dd, > struct device_node *node) > { > struct stm32_exti_host_data *host_data; > > host_data = kzalloc(sizeof(*host_data), GFP_KERNEL); > if (!host_data) > return NULL; > > host_data->drv_data = dd; > host_data->chips_data = kcalloc(dd->bank_nr, > sizeof(struct stm32_exti_chip_data), > GFP_KERNEL); The function stm32_exti_probe *does* use devm_k?alloc, so perhaps you were getting confused with that? Steve > return ret; > } > > 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.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 DDD7FC76188 for ; Mon, 22 Jul 2019 10:26:50 +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 B406521897 for ; Mon, 22 Jul 2019 10:26:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ED407ogu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B406521897 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=TtPWWWoVB5XyX1d3IwJLNBAJ9YF/ykpJEggjhcmd0qc=; b=ED407oguFUPXRDvvwAcjDI1g+s 5SvWhrjJqYQZc1I3PR8Gqbd0D2nfghQo/B7/w9oPHSbeirNBUIQIKiLyvFwqxjSK5J7Fq0MA7u1uM uyMuysSO/UntzRRRFgRFlNvBNZgyeV24Cnj3M5S3vEFuGkU99oN93GWC6HKtMer2hj7to/p/WqRHK v6TR9vFm4+vR1MU5X5DGc6ZnIqnesjLQXmOwSKrOjj2SauA4NsDt7QChDoNmyPcjLP7m4L22CV6zX zMSkUQ7GBKtOhrVahgPriulj31rl7+Rz/7DP2nWfAGfr+tc4HW9zsWBGjRrs07KBgspeI8H/vYb8c uuIQvtIA==; 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 1hpVWs-0007VP-9B; Mon, 22 Jul 2019 10:26:50 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hpVWK-0007GM-L3 for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 10:26:20 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6B0FD28; Mon, 22 Jul 2019 03:26:12 -0700 (PDT) Received: from [10.1.196.133] (e112269-lin.cambridge.arm.com [10.1.196.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0D4AE3F71A; Mon, 22 Jul 2019 03:26:10 -0700 (PDT) Subject: Re: [PATCH] rqchip/stm32: Remove unneeded call to kfree To: Hariprasad Kelam , Thomas Gleixner , Jason Cooper , Marc Zyngier , Maxime Coquelin , Alexandre Torgue , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org References: <20190719184606.GA4701@hari-Inspiron-1545> From: Steven Price Message-ID: <1d9aa4be-4da2-b532-4787-c98869c0bd9d@arm.com> Date: Mon, 22 Jul 2019 11:26:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190719184606.GA4701@hari-Inspiron-1545> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_032617_249278_57153146 X-CRM114-Status: GOOD ( 16.12 ) 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: , 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 19/07/2019 19:46, Hariprasad Kelam wrote: > Memory allocated by devm_ alloc will be freed upon device detachment. So > we may not require free memory. > > Signed-off-by: Hariprasad Kelam > --- > drivers/irqchip/irq-stm32-exti.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c > index e00f2fa..46ec0af 100644 > --- a/drivers/irqchip/irq-stm32-exti.c > +++ b/drivers/irqchip/irq-stm32-exti.c > @@ -779,8 +779,6 @@ static int __init stm32_exti_init(const struct stm32_exti_drv_data *drv_data, > irq_domain_remove(domain); > out_unmap: > iounmap(host_data->base); > - kfree(host_data->chips_data); > - kfree(host_data); In the commit this is based on these variables are not allocated using a devm_ alloc function: $ git show e00f2fa | grep -A12 *stm32_exti_host_init > stm32_exti_host_data *stm32_exti_host_init(const struct stm32_exti_drv_data *dd, > struct device_node *node) > { > struct stm32_exti_host_data *host_data; > > host_data = kzalloc(sizeof(*host_data), GFP_KERNEL); > if (!host_data) > return NULL; > > host_data->drv_data = dd; > host_data->chips_data = kcalloc(dd->bank_nr, > sizeof(struct stm32_exti_chip_data), > GFP_KERNEL); The function stm32_exti_probe *does* use devm_k?alloc, so perhaps you were getting confused with that? Steve > return ret; > } > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel