From patchwork Fri Jul 4 17:39:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HIMANGI SARAOGI X-Patchwork-Id: 4482271 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3EB339F26C for ; Fri, 4 Jul 2014 17:40:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7333520357 for ; Fri, 4 Jul 2014 17:40:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4C2C20381 for ; Fri, 4 Jul 2014 17:39:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759248AbaGDRj7 (ORCPT ); Fri, 4 Jul 2014 13:39:59 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:64167 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754559AbaGDRj6 (ORCPT ); Fri, 4 Jul 2014 13:39:58 -0400 Received: by mail-pa0-f48.google.com with SMTP id et14so2256774pad.21 for ; Fri, 04 Jul 2014 10:39:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=yMTT7SybSWDriITZYYynUYBRNF2eJ+JwN13kRG8X0a0=; b=Cooepb6txaPrfhhKfEoU0VzXf9P90pqLLBmgb/8bhSyQDG0SltCQZAzygIxEFrW1dB mGHCeL/98pbm7vB+DezkFADyb3cUshiFNJYgGPpESt5UU7UnvAQ/UPTUmrMGJ9Kon+Ut Z6K12ws90kvspLxzBphKWrwgpaQU2t7Igwf2mP5woj0sLeubtHeY5otd8dkkYgpqLMX/ f9TLHo6lAJVx1OEkcI/Q7sh4qLRF72EsH5AVxprsBxTDGVrio6BzyPaErFITTdU6fLB6 710D50VYSBsuE7rcRgGcm43rBx8+0Z+EFtSD6dYPaOsqx77gepnGhxfp/Z1GNiICWSQO A5cw== X-Received: by 10.70.61.4 with SMTP id l4mr11250534pdr.112.1404495598396; Fri, 04 Jul 2014 10:39:58 -0700 (PDT) Received: from localhost ([122.178.79.96]) by mx.google.com with ESMTPSA id cj1sm157382928pac.40.2014.07.04.10.39.54 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 04 Jul 2014 10:39:57 -0700 (PDT) Date: Fri, 4 Jul 2014 23:09:49 +0530 From: Himangi Saraogi To: Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel Cc: julia.lawall@lip6.fr Subject: [PATCH] spi: au1550: Fix bug in deallocation of memory Message-ID: <20140704173949.GA8558@himangi-Dell> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes a bug on the deallocation of memory allocated using request_mem_region, by using release_mem_region instead of release_resource and kfree. Signed-off-by: Himangi Saraogi --- drivers/spi/spi-au1550.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c index 67375a1..fb61464 100644 --- a/drivers/spi/spi-au1550.c +++ b/drivers/spi/spi-au1550.c @@ -925,8 +925,7 @@ err_no_txdma: iounmap((void __iomem *)hw->regs); err_ioremap: - release_resource(hw->ioarea); - kfree(hw->ioarea); + release_mem_region(r->start, sizeof(psc_spi_t)); err_no_iores: err_no_pdata: @@ -946,8 +945,7 @@ static int au1550_spi_remove(struct platform_device *pdev) spi_bitbang_stop(&hw->bitbang); free_irq(hw->irq, hw); iounmap((void __iomem *)hw->regs); - release_resource(hw->ioarea); - kfree(hw->ioarea); + release_mem_region(r->start, sizeof(psc_spi_t)); if (hw->usedma) { au1550_spi_dma_rxtmp_free(hw);