From patchwork Thu Jun 12 22:02:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HIMANGI SARAOGI X-Patchwork-Id: 4348971 Return-Path: X-Original-To: patchwork-alsa-devel@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 F3454BEEAA for ; Fri, 13 Jun 2014 12:54:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2DBB82024C for ; Fri, 13 Jun 2014 12:54:00 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id EAE40201BA for ; Fri, 13 Jun 2014 12:53:57 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 59E73261A38; Fri, 13 Jun 2014 14:53:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id A62CB260815; Fri, 13 Jun 2014 14:49:45 +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 D441826072A; Fri, 13 Jun 2014 00:02:23 +0200 (CEST) Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by alsa0.perex.cz (Postfix) with ESMTP id 918C3260309 for ; Fri, 13 Jun 2014 00:02:15 +0200 (CEST) Received: by mail-pd0-f170.google.com with SMTP id g10so1393544pdj.15 for ; Thu, 12 Jun 2014 15:02:14 -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=RujkLSjY5+OsZdOA6qj7L+kG/nNbixRLQyU6IdjKfsY=; b=hOe39TiPwslHk3A11Di1tc8dgiN7nAcrgWEO6U3uLWPYNQDIQeh5WRAErx1ertO1V/ /dWqqT2DO63sO82v4WWL5JR/Nr2+wsHyXTPs8U/7IjMEZ8sj48Af0WpBgAum/uuPxnB8 oeb3aRGLvYXNorFV23UHChbRPJPTdF3QXEbIBwBa6E7ELHC5YhuXFOokTYmn8oyBbZPG 9sQ+Bwidkkj9lmswVnykyt+jByECMR8EjCQWhXVSA7dDT+5gBYMhno9U1dhLV4ka9ZoC bAT7gtFqpuhJo3J3lq3jWcr4R880Al+Qx+m7ExMWO9QmnvQfBLICgECZZs5UOcreGFg7 qKcw== X-Received: by 10.66.192.104 with SMTP id hf8mr24552283pac.13.1402610533875; Thu, 12 Jun 2014 15:02:13 -0700 (PDT) Received: from localhost ([122.178.72.156]) by mx.google.com with ESMTPSA id ty3sm10884422pab.20.2014.06.12.15.02.10 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 12 Jun 2014 15:02:12 -0700 (PDT) Date: Fri, 13 Jun 2014 03:32:07 +0530 From: Himangi Saraogi To: Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Message-ID: <20140612220206.GA10257@himangi-Dell> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Fri, 13 Jun 2014 14:49:43 +0200 Cc: julia.lawall@lip6.fr Subject: [alsa-devel] [PATCH] ALSA: au1x00: Use resource_size 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Use the function resource_size, which reduces the chance of introducing off-by-one errors in calculating the resource size. The semantic patch that makes this change is as follows: // @@ struct resource *res; @@ - (res->end - res->start) + 1 + resource_size(res) // Signed-off-by: Himangi Saraogi Acked-by: Julia Lawall --- Not compile tested. sound/mips/au1x00.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c index d10ef76..86583c7 100644 --- a/sound/mips/au1x00.c +++ b/sound/mips/au1x00.c @@ -649,7 +649,7 @@ static int au1000_ac97_probe(struct platform_device *pdev) err = -EBUSY; au1000->ac97_res_port = request_mem_region(r->start, - r->end - r->start + 1, pdev->name); + resource_size(r), pdev->name); if (!au1000->ac97_res_port) { snd_printk(KERN_ERR "ALSA AC97: can't grab AC97 port\n"); goto out;