From: Himangi Saraogi <himangi774@gmail.com>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Cc: julia.lawall@lip6.fr
Subject: [PATCH] ALSA: au1x00: Use resource_size
Date: Fri, 13 Jun 2014 03:32:07 +0530 [thread overview]
Message-ID: <20140612220206.GA10257@himangi-Dell> (raw)
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:
// <smpl>
@@
struct resource *res;
@@
- (res->end - res->start) + 1
+ resource_size(res)
// </smpl>
Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
---
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;
--
1.9.1
next reply other threads:[~2014-06-12 22:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-12 22:02 Himangi Saraogi [this message]
2014-06-13 8:48 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140612220206.GA10257@himangi-Dell \
--to=himangi774@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®