Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

video: hpfb: use resource_size()

The size calculation is done incorrectly here because it should include
both the start and end (end - start + 1).

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>

authored by

axel lin and committed by
Paul Mundt
56fb22f7 7fe029df

+3 -3
+3 -3
drivers/video/hpfb.c
··· 321 321 unsigned long paddr, vaddr; 322 322 323 323 paddr = d->resource.start; 324 - if (!request_mem_region(d->resource.start, d->resource.end - d->resource.start, d->name)) 324 + if (!request_mem_region(d->resource.start, resource_size(&d->resource), d->name)) 325 325 return -EBUSY; 326 326 327 327 if (d->scode >= DIOII_SCBASE) { 328 - vaddr = (unsigned long)ioremap(paddr, d->resource.end - d->resource.start); 328 + vaddr = (unsigned long)ioremap(paddr, resource_size(&d->resource)); 329 329 } else { 330 330 vaddr = paddr + DIO_VIRADDRBASE; 331 331 } ··· 344 344 unregister_framebuffer(&fb_info); 345 345 if (d->scode >= DIOII_SCBASE) 346 346 iounmap((void *)fb_regs); 347 - release_mem_region(d->resource.start, d->resource.end - d->resource.start); 347 + release_mem_region(d->resource.start, resource_size(&d->resource)); 348 348 } 349 349 350 350 static struct dio_device_id hpfb_dio_tbl[] = {