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: 9645041 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 D1CFB6032A for ; Sun, 26 Mar 2017 14:43:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C35AF27F89 for ; Sun, 26 Mar 2017 14:43:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B82A727F9A; Sun, 26 Mar 2017 14:43:18 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 6F9D727F8C for ; Sun, 26 Mar 2017 14:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751584AbdCZOnL (ORCPT ); Sun, 26 Mar 2017 10:43:11 -0400 Received: from mail-wr0-f181.google.com ([209.85.128.181]:36738 "EHLO mail-wr0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751522AbdCZOnJ (ORCPT ); Sun, 26 Mar 2017 10:43:09 -0400 Received: by mail-wr0-f181.google.com with SMTP id w11so10707280wrc.3 for ; Sun, 26 Mar 2017 07:43:08 -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=Dcjp/wQIbOn0ZiTsRZsgE8zCTwZ529qm/FoQHjYHXjf3EFtwRMCX8nq0HN+EsrLFsE zGk6fMfdhgZqo/rZhqoiiJo74holS/Gzijceec+9qx2CnVSPaMoGYtkmOPdvxJPNNZIM 38ckSjlCEhNgGlu+sfIdHXXIaG3lzB+a7VM9bizYBcpRtrzRHNC5BGFU8IG534Fs1ZDT VX5zbDtwecmNiO4sVLk/BdF3SpLHtXBqjICoXsxDC/wmCy6AaZxKgBukpMcvkI5p2uRs qthSXuSBf1oIDP5OA8yh1jBwiizW+jRKYh6fbW8MgQz2MqLviYCrCnKrdotYjHUy8cIO ODaQ== X-Gm-Message-State: AFeK/H0KqLokFbZtyMUFBzTC5Eb/MW82kX+xi/TdWzHLAbxIj3l4cqB4t65hymfJ80nsbFWL 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 Cc: Leo Yan Subject: [PATCH 5/5] ALSA: AACI: Convert to use devm_ioremap_resource() 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> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.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;