Commit 56fb22f7ca11ba5f04c297b7f7aa758ac8dbb2ce

Authored by axel lin
Committed by Paul Mundt
1 parent 7fe029df42

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>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

drivers/video/hpfb.c
... ... @@ -321,11 +321,11 @@
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,7 +344,7 @@
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[] = {