[1/2] ALSA: au1x00: Use resource_size instead of computation
diff mbox

Message ID 1401290047-30005-2-git-send-email-benoit.taine@lip6.fr
State Accepted
Commit 82285f254ca8bacb0c089f87516b9db2bc13d580
Headers show

Commit Message

Benoit Taine May 28, 2014, 3:14 p.m. UTC
This issue was reported by coccicheck using the semantic patch 
at scripts/coccinelle/api/resource_size.cocci

Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
---
Not compile tested, due incompatible architecture.

 sound/mips/au1x00.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Takashi Iwai May 28, 2014, 3:51 p.m. UTC | #1
At Wed, 28 May 2014 17:14:06 +0200,
Benoit Taine wrote:
> 
> This issue was reported by coccicheck using the semantic patch 
> at scripts/coccinelle/api/resource_size.cocci
> 
> Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>

Applied, thanks.


Takashi

> ---
> Not compile tested, due incompatible architecture.
> 
>  sound/mips/au1x00.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c
> index d10ef76..fbcaa54 100644
> --- a/sound/mips/au1x00.c
> +++ b/sound/mips/au1x00.c
> @@ -648,14 +648,14 @@ static int au1000_ac97_probe(struct platform_device *pdev)
>  		goto out;
>  
>  	err = -EBUSY;
> -	au1000->ac97_res_port = request_mem_region(r->start,
> -					r->end - r->start + 1, pdev->name);
> +	au1000->ac97_res_port = request_mem_region(r->start, resource_size(r),
> +						   pdev->name);
>  	if (!au1000->ac97_res_port) {
>  		snd_printk(KERN_ERR "ALSA AC97: can't grab AC97 port\n");
>  		goto out;
>  	}
>  
> -	io = ioremap(r->start, r->end - r->start + 1);
> +	io = ioremap(r->start, resource_size(r));
>  	if (!io)
>  		goto out;
>  
>

Patch
diff mbox

diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c
index d10ef76..fbcaa54 100644
--- a/sound/mips/au1x00.c
+++ b/sound/mips/au1x00.c
@@ -648,14 +648,14 @@  static int au1000_ac97_probe(struct platform_device *pdev)
 		goto out;
 
 	err = -EBUSY;
-	au1000->ac97_res_port = request_mem_region(r->start,
-					r->end - r->start + 1, pdev->name);
+	au1000->ac97_res_port = request_mem_region(r->start, resource_size(r),
+						   pdev->name);
 	if (!au1000->ac97_res_port) {
 		snd_printk(KERN_ERR "ALSA AC97: can't grab AC97 port\n");
 		goto out;
 	}
 
-	io = ioremap(r->start, r->end - r->start + 1);
+	io = ioremap(r->start, resource_size(r));
 	if (!io)
 		goto out;