From: Takashi Iwai Subject: Re: [PATCH] ALSA: au1x00: Use resource_size Date: Fri, 13 Jun 2014 10:48:23 +0200 Message-ID: References: <20140612220206.GA10257@himangi-Dell> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <20140612220206.GA10257@himangi-Dell> Sender: linux-kernel-owner@vger.kernel.org To: Himangi Saraogi Cc: Jaroslav Kysela , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, julia.lawall@lip6.fr List-Id: alsa-devel@alsa-project.org At Fri, 13 Jun 2014 03:32:07 +0530, Himangi Saraogi wrote: > > 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 This was already fixed in sound git tree. thanks, Takashi > --- > 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 >