From patchwork Wed Aug 20 14:40:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markos Chandras X-Patchwork-Id: 4752111 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6456FC0338 for ; Wed, 20 Aug 2014 14:40:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3835720136 for ; Wed, 20 Aug 2014 14:40:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 078ED200E6 for ; Wed, 20 Aug 2014 14:40:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751220AbaHTOkd (ORCPT ); Wed, 20 Aug 2014 10:40:33 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:29704 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750952AbaHTOkc (ORCPT ); Wed, 20 Aug 2014 10:40:32 -0400 Received: from KLMAIL01.kl.imgtec.org (unknown [192.168.5.35]) by Websense Email Security Gateway with ESMTPS id 220CF55E59495; Wed, 20 Aug 2014 15:40:27 +0100 (IST) Received: from LEMAIL01.le.imgtec.org (192.168.152.62) by KLMAIL01.kl.imgtec.org (192.168.5.35) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 20 Aug 2014 15:40:29 +0100 Received: from mchandras-linux.le.imgtec.org (192.168.154.158) by LEMAIL01.le.imgtec.org (192.168.152.62) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 20 Aug 2014 15:40:29 +0100 From: Markos Chandras To: CC: Markos Chandras , Mark Brown , Himangi Saraogi , , Subject: [PATCH] SPI: spi-au1550: Fix build problem in au1550_spi_remove Date: Wed, 20 Aug 2014 15:40:13 +0100 Message-ID: <1408545613-28348-1-git-send-email-markos.chandras@imgtec.com> X-Mailer: git-send-email 2.0.4 MIME-Version: 1.0 X-Originating-IP: [192.168.154.158] Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Commit 30670539b867 ("spi: au1550: Fix bug in deallocation of memory") switched from release_resource to release_mem_region to release memory regions allocated using the request_mem_region. However, a build problem was introduced due to 'r' being undefined in that function. We fix this by having 'r' being defined as the platform's IORESROUCE_MEM region. This fixes a problem triggered by the db1xxx defconfig in the MIPS tree: drivers/spi/spi-au1550.c: In function 'au1550_spi_remove': drivers/spi/spi-au1550.c:948:21: error: 'r' undeclared (first use in this function) release_mem_region(r->start, sizeof(psc_spi_t)); Cc: Mark Brown Cc: Himangi Saraogi Cc: linux-spi@vger.kernel.org Cc: linux-mips@linux-mips.org Signed-off-by: Markos Chandras --- This has only been compile tested --- drivers/spi/spi-au1550.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c index 40c3d43c9292..f7edb504df78 100644 --- a/drivers/spi/spi-au1550.c +++ b/drivers/spi/spi-au1550.c @@ -937,6 +937,7 @@ err_nomem: static int au1550_spi_remove(struct platform_device *pdev) { + struct resource *r; struct au1550_spi *hw = platform_get_drvdata(pdev); dev_info(&pdev->dev, "spi master remove: bus_num=%d\n", @@ -945,6 +946,13 @@ static int au1550_spi_remove(struct platform_device *pdev) spi_bitbang_stop(&hw->bitbang); free_irq(hw->irq, hw); iounmap((void __iomem *)hw->regs); + + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!r) { + dev_err(&pdev->dev, "no mmio resource\n"); + return -ENODEV; + } + release_mem_region(r->start, sizeof(psc_spi_t)); if (hw->usedma) {