From patchwork Sun Mar 26 14:41:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 9645411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 06BC8602BF for ; Mon, 27 Mar 2017 07:09:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECC732832D for ; Mon, 27 Mar 2017 07:09:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E02E828356; Mon, 27 Mar 2017 07:09:37 +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=-1.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 340792832D for ; Mon, 27 Mar 2017 07:09:37 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 71568266C78; Mon, 27 Mar 2017 09:08:00 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4AEEF266C0C; Sun, 26 Mar 2017 16:42:54 +0200 (CEST) Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com [209.85.128.176]) by alsa0.perex.cz (Postfix) with ESMTP id 9662B266BFD for ; Sun, 26 Mar 2017 16:42:52 +0200 (CEST) Received: by mail-wr0-f176.google.com with SMTP id w43so11077746wrb.0 for ; Sun, 26 Mar 2017 07:42:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nWkUeaxeGMxaj0cB7gWYS2wiwG302GpGU8GcxUamdic=; b=F/SzTh8i30EYcU4GUEKYOK7BgymlXRVkd4Mo3wHVMYlAoNI4Y1E/iYzPaRVnBnVFQE 169FPF5SBMfgDP42pYDTbybKbqCfxX4NTGXa00JoliVM0xGauip8vByqYcfOFSQeiN6/ nX6Shr9V+xeoaKl/rT5GacfcMPkG8RB39A8GQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nWkUeaxeGMxaj0cB7gWYS2wiwG302GpGU8GcxUamdic=; b=YtRio3O4OrMpXBdKe/k2ob4j0jWYWxdvSlB0Ga7b5eBWI835DM7c0RDfLzD1eFDTpj e7AoXzbTQHf2y9L1ICgrc3nw91H8aCkmceViFHuKND5o1A9chQ/hNeqBXmrahWQeSNpp jjxCY/VLO9yWEjtiGf5zPYfmL6Z1oZP9kQIt7mKK1RK8fPGOyrbZ+wfGD/aCgClb/5u5 NamOzD3dogEC7bL1ghTvcG5m8DAEUC+TNXXj0b3+arQvygUNNJgETcJj9WmefOYK1kwW 8pC3dJRFEhIKP3bOlwh1/49TEcEcx3Vgj5bBfucGr7fRUapI0sY3OSYDYF6WjtqcNkbE 2t0Q== X-Gm-Message-State: AFeK/H3kwI0zBhja3GgFcTaR8nuENTGnss5BaCCYoGuvf//2ajjwej7uxPOaxylHDivtouBE X-Received: by 10.28.182.7 with SMTP id g7mr6068632wmf.108.1490539372311; Sun, 26 Mar 2017 07:42:52 -0700 (PDT) Received: from localhost.localdomain (li1529-187.members.linode.com. [139.162.244.187]) by smtp.gmail.com with ESMTPSA id l90sm10619516wmi.25.2017.03.26.07.42.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 26 Mar 2017 07:42:51 -0700 (PDT) From: Leo Yan To: Russell King , Dmitry Torokhov , Alessandro Zummo , Alexandre Belloni , Linus Walleij , Baptiste Reynal , Alex Williamson , Jaroslav Kysela , Takashi Iwai , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, alsa-devel@alsa-project.org Date: Sun, 26 Mar 2017 22:41:54 +0800 Message-Id: <1490539314-9681-6-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490539314-9681-1-git-send-email-leo.yan@linaro.org> References: <1490539314-9681-1-git-send-email-leo.yan@linaro.org> X-Mailman-Approved-At: Mon, 27 Mar 2017 09:07:53 +0200 Cc: Leo Yan Subject: [alsa-devel] [PATCH 5/5] ALSA: AACI: Convert to use devm_ioremap_resource() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Convert to use devm_ioremap_resource() in probe function, otherwise it's missed to unremap this region if probe failed or rmmod module. Signed-off-by: Leo Yan --- sound/arm/aaci.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 4140b1b..2078568 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c @@ -990,19 +990,13 @@ static int aaci_probe(struct amba_device *dev, struct aaci *aaci; int ret, i; - ret = amba_request_regions(dev, NULL); - if (ret) - return ret; - aaci = aaci_init_card(dev); - if (!aaci) { - ret = -ENOMEM; - goto out; - } + if (!aaci) + return -ENOMEM; - aaci->base = ioremap(dev->res.start, resource_size(&dev->res)); - if (!aaci->base) { - ret = -ENOMEM; + aaci->base = devm_ioremap_resource(&dev->dev, &dev->res); + if (IS_ERR(aaci->base)) { + ret = PTR_ERR(aaci->base); goto out; } @@ -1064,9 +1058,7 @@ static int aaci_probe(struct amba_device *dev, } out: - if (aaci) - snd_card_free(aaci->card); - amba_release_regions(dev); + snd_card_free(aaci->card); return ret; } @@ -1079,7 +1071,6 @@ static int aaci_remove(struct amba_device *dev) writel(0, aaci->base + AACI_MAINCR); snd_card_free(card); - amba_release_regions(dev); } return 0;