diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-12-29 00:01:32 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-31 17:06:05 -0500 |
commit | e3a411a3dfc1d633504aa63efab32b7e00318454 (patch) | |
tree | 2ba6117448edd7056c8fa48cc6a696ae73a6c21a /drivers/video/ffb.c | |
parent | 6fc5bae797a6632bbccdd49a1b6a96121368a4b9 (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/ffb.c')
-rw-r--r-- | drivers/video/ffb.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index 949141bd44d4..15854aec3180 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c | |||
@@ -910,7 +910,8 @@ static int ffb_init_one(struct of_device *op) | |||
910 | all->par.dac = of_ioremap(&op->resource[1], 0, | 910 | all->par.dac = of_ioremap(&op->resource[1], 0, |
911 | sizeof(struct ffb_dac), "ffb dac"); | 911 | sizeof(struct ffb_dac), "ffb dac"); |
912 | if (!all->par.dac) { | 912 | if (!all->par.dac) { |
913 | of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); | 913 | of_iounmap(&op->resource[2], |
914 | all->par.fbc, sizeof(struct ffb_fbc)); | ||
914 | kfree(all); | 915 | kfree(all); |
915 | return -ENOMEM; | 916 | return -ENOMEM; |
916 | } | 917 | } |
@@ -968,8 +969,10 @@ static int ffb_init_one(struct of_device *op) | |||
968 | 969 | ||
969 | if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { | 970 | if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { |
970 | printk(KERN_ERR "ffb: Could not allocate color map.\n"); | 971 | printk(KERN_ERR "ffb: Could not allocate color map.\n"); |
971 | of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); | 972 | of_iounmap(&op->resource[2], |
972 | of_iounmap(all->par.dac, sizeof(struct ffb_dac)); | 973 | all->par.fbc, sizeof(struct ffb_fbc)); |
974 | of_iounmap(&op->resource[1], | ||
975 | all->par.dac, sizeof(struct ffb_dac)); | ||
973 | kfree(all); | 976 | kfree(all); |
974 | return -ENOMEM; | 977 | return -ENOMEM; |
975 | } | 978 | } |
@@ -980,8 +983,10 @@ static int ffb_init_one(struct of_device *op) | |||
980 | if (err < 0) { | 983 | if (err < 0) { |
981 | printk(KERN_ERR "ffb: Could not register framebuffer.\n"); | 984 | printk(KERN_ERR "ffb: Could not register framebuffer.\n"); |
982 | fb_dealloc_cmap(&all->info.cmap); | 985 | fb_dealloc_cmap(&all->info.cmap); |
983 | of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); | 986 | of_iounmap(&op->resource[2], |
984 | of_iounmap(all->par.dac, sizeof(struct ffb_dac)); | 987 | all->par.fbc, sizeof(struct ffb_fbc)); |
988 | of_iounmap(&op->resource[1], | ||
989 | all->par.dac, sizeof(struct ffb_dac)); | ||
985 | kfree(all); | 990 | kfree(all); |
986 | return err; | 991 | return err; |
987 | } | 992 | } |
@@ -1003,19 +1008,19 @@ static int __devinit ffb_probe(struct of_device *dev, const struct of_device_id | |||
1003 | return ffb_init_one(op); | 1008 | return ffb_init_one(op); |
1004 | } | 1009 | } |
1005 | 1010 | ||
1006 | static int __devexit ffb_remove(struct of_device *dev) | 1011 | static int __devexit ffb_remove(struct of_device *op) |
1007 | { | 1012 | { |
1008 | struct all_info *all = dev_get_drvdata(&dev->dev); | 1013 | struct all_info *all = dev_get_drvdata(&op->dev); |
1009 | 1014 | ||
1010 | unregister_framebuffer(&all->info); | 1015 | unregister_framebuffer(&all->info); |
1011 | fb_dealloc_cmap(&all->info.cmap); | 1016 | fb_dealloc_cmap(&all->info.cmap); |
1012 | 1017 | ||
1013 | of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); | 1018 | of_iounmap(&op->resource[2], all->par.fbc, sizeof(struct ffb_fbc)); |
1014 | of_iounmap(all->par.dac, sizeof(struct ffb_dac)); | 1019 | of_iounmap(&op->resource[1], all->par.dac, sizeof(struct ffb_dac)); |
1015 | 1020 | ||
1016 | kfree(all); | 1021 | kfree(all); |
1017 | 1022 | ||
1018 | dev_set_drvdata(&dev->dev, NULL); | 1023 | dev_set_drvdata(&op->dev, NULL); |
1019 | 1024 | ||
1020 | return 0; | 1025 | return 0; |
1021 | } | 1026 | } |