aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/cg3.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-12-29 00:01:32 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-31 17:06:05 -0500
commite3a411a3dfc1d633504aa63efab32b7e00318454 (patch)
tree2ba6117448edd7056c8fa48cc6a696ae73a6c21a /drivers/video/cg3.c
parent6fc5bae797a6632bbccdd49a1b6a96121368a4b9 (diff)
[SPARC64]: Fix of_iounmap() region release.
We need to pass in the resource otherwise we cannot release the region properly. We must know whether it is an I/O or MEM resource. Spotted by Eric Brower. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/video/cg3.c')
-rw-r--r--drivers/video/cg3.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c
index 9c8c753ef454..ada6f7e3a891 100644
--- a/drivers/video/cg3.c
+++ b/drivers/video/cg3.c
@@ -403,8 +403,10 @@ static int __devinit cg3_init_one(struct of_device *op)
403 cg3_do_default_mode(&all->par); 403 cg3_do_default_mode(&all->par);
404 404
405 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { 405 if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
406 of_iounmap(all->par.regs, sizeof(struct cg3_regs)); 406 of_iounmap(&op->resource[0],
407 of_iounmap(all->info.screen_base, all->par.fbsize); 407 all->par.regs, sizeof(struct cg3_regs));
408 of_iounmap(&op->resource[0],
409 all->info.screen_base, all->par.fbsize);
408 kfree(all); 410 kfree(all);
409 return -ENOMEM; 411 return -ENOMEM;
410 } 412 }
@@ -415,8 +417,10 @@ static int __devinit cg3_init_one(struct of_device *op)
415 err = register_framebuffer(&all->info); 417 err = register_framebuffer(&all->info);
416 if (err < 0) { 418 if (err < 0) {
417 fb_dealloc_cmap(&all->info.cmap); 419 fb_dealloc_cmap(&all->info.cmap);
418 of_iounmap(all->par.regs, sizeof(struct cg3_regs)); 420 of_iounmap(&op->resource[0],
419 of_iounmap(all->info.screen_base, all->par.fbsize); 421 all->par.regs, sizeof(struct cg3_regs));
422 of_iounmap(&op->resource[0],
423 all->info.screen_base, all->par.fbsize);
420 kfree(all); 424 kfree(all);
421 return err; 425 return err;
422 } 426 }
@@ -436,19 +440,19 @@ static int __devinit cg3_probe(struct of_device *dev, const struct of_device_id
436 return cg3_init_one(op); 440 return cg3_init_one(op);
437} 441}
438 442
439static int __devexit cg3_remove(struct of_device *dev) 443static int __devexit cg3_remove(struct of_device *op)
440{ 444{
441 struct all_info *all = dev_get_drvdata(&dev->dev); 445 struct all_info *all = dev_get_drvdata(&op->dev);
442 446
443 unregister_framebuffer(&all->info); 447 unregister_framebuffer(&all->info);
444 fb_dealloc_cmap(&all->info.cmap); 448 fb_dealloc_cmap(&all->info.cmap);
445 449
446 of_iounmap(all->par.regs, sizeof(struct cg3_regs)); 450 of_iounmap(&op->resource[0], all->par.regs, sizeof(struct cg3_regs));
447 of_iounmap(all->info.screen_base, all->par.fbsize); 451 of_iounmap(&op->resource[0], all->info.screen_base, all->par.fbsize);
448 452
449 kfree(all); 453 kfree(all);
450 454
451 dev_set_drvdata(&dev->dev, NULL); 455 dev_set_drvdata(&op->dev, NULL);
452 456
453 return 0; 457 return 0;
454} 458}