From patchwork Sat Jan 19 14:57:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Brezillon X-Patchwork-Id: 10772063 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 68B981390 for ; Sat, 19 Jan 2019 14:58:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A1DA2D9EC for ; Sat, 19 Jan 2019 14:58:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CDDD2DA0C; Sat, 19 Jan 2019 14:58:09 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 EA9E32D9EC for ; Sat, 19 Jan 2019 14:58:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728231AbfASO6I (ORCPT ); Sat, 19 Jan 2019 09:58:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:51986 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728218AbfASO6I (ORCPT ); Sat, 19 Jan 2019 09:58:08 -0500 Received: from localhost.localdomain (unknown [91.160.177.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BAFBF2084F; Sat, 19 Jan 2019 14:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547909887; bh=FJCZ8w3hdk8saLa65GaLMlTiCDwL8KyOO4Sc5mm5l2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JxIkJHG6whdf3Fup+BUjq4mzXc/Z3yxinX0/N4v/csXq+f/PtPDtO6LVX1xj46wfs FsEN2T5G+Ax7RA/Jg05YjZdbkFSF7fTFmSh0HP5snVmkr67O/gyeJGOlgpyDz8jJ9n jDEbLmxoHH3YsgFlQtXNIPXc4Vv+UluAT3FPrNcA= From: Boris Brezillon To: Mark Brown , linux-spi@vger.kernel.org Cc: Boris Brezillon Subject: [PATCH 2/2] spi: spi-mem: Fix a memory leak in spi_mem_dirmap_destroy() Date: Sat, 19 Jan 2019 15:57:57 +0100 Message-Id: <20190119145757.1735-2-bbrezillon@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190119145757.1735-1-bbrezillon@kernel.org> References: <20190119145757.1735-1-bbrezillon@kernel.org> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The dirmap descriptor object allocated in spi_mem_dirmap_create is never freed. Add a kfree(desc) in spi_mem_dirmap_destroy(). Fixes: aa167f3fed0c ("spi: spi-mem: Add a new API to support direct mapping") Signed-off-by: Boris Brezillon --- drivers/spi/spi-mem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index 08ba43506e81..9487c9cd68bd 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -547,6 +547,8 @@ void spi_mem_dirmap_destroy(struct spi_mem_dirmap_desc *desc) if (!desc->nodirmap && ctlr->mem_ops && ctlr->mem_ops->dirmap_destroy) ctlr->mem_ops->dirmap_destroy(desc); + + kfree(desc); } EXPORT_SYMBOL_GPL(spi_mem_dirmap_destroy);