diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2009-06-16 18:34:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-16 22:47:59 -0400 |
commit | ddc518d9f88d7cf82bd974737ce977193785335d (patch) | |
tree | d7041f8f0faba5079813d396362fa5e5d56d5508 /drivers/video/s3c-fb.c | |
parent | 493f139ecf9ee72f73ccbabd016325a145e884ee (diff) |
s3c-fb: fix resource releasing on error during probing
All resources are released in s3c_fb_win_release so remove other places of
resources releasing. Add releasing of an allocated fb_info structure as
well.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/s3c-fb.c')
-rw-r--r-- | drivers/video/s3c-fb.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 53bca288e836..43680e545427 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c | |||
@@ -725,9 +725,12 @@ static void s3c_fb_free_memory(struct s3c_fb *sfb, struct s3c_fb_win *win) | |||
725 | */ | 725 | */ |
726 | static void s3c_fb_release_win(struct s3c_fb *sfb, struct s3c_fb_win *win) | 726 | static void s3c_fb_release_win(struct s3c_fb *sfb, struct s3c_fb_win *win) |
727 | { | 727 | { |
728 | fb_dealloc_cmap(&win->fbinfo->cmap); | 728 | if (win->fbinfo) { |
729 | unregister_framebuffer(win->fbinfo); | 729 | unregister_framebuffer(win->fbinfo); |
730 | s3c_fb_free_memory(sfb, win); | 730 | fb_dealloc_cmap(&win->fbinfo->cmap); |
731 | s3c_fb_free_memory(sfb, win); | ||
732 | framebuffer_release(win->fbinfo); | ||
733 | } | ||
731 | } | 734 | } |
732 | 735 | ||
733 | /** | 736 | /** |
@@ -778,7 +781,7 @@ static int __devinit s3c_fb_probe_win(struct s3c_fb *sfb, unsigned int win_no, | |||
778 | ret = s3c_fb_alloc_memory(sfb, win); | 781 | ret = s3c_fb_alloc_memory(sfb, win); |
779 | if (ret) { | 782 | if (ret) { |
780 | dev_err(sfb->dev, "failed to allocate display memory\n"); | 783 | dev_err(sfb->dev, "failed to allocate display memory\n"); |
781 | goto err_framebuffer; | 784 | return ret; |
782 | } | 785 | } |
783 | 786 | ||
784 | /* setup the r/b/g positions for the window's palette */ | 787 | /* setup the r/b/g positions for the window's palette */ |
@@ -801,7 +804,7 @@ static int __devinit s3c_fb_probe_win(struct s3c_fb *sfb, unsigned int win_no, | |||
801 | ret = s3c_fb_check_var(&fbinfo->var, fbinfo); | 804 | ret = s3c_fb_check_var(&fbinfo->var, fbinfo); |
802 | if (ret < 0) { | 805 | if (ret < 0) { |
803 | dev_err(sfb->dev, "check_var failed on initial video params\n"); | 806 | dev_err(sfb->dev, "check_var failed on initial video params\n"); |
804 | goto err_alloc_mem; | 807 | return ret; |
805 | } | 808 | } |
806 | 809 | ||
807 | /* create initial colour map */ | 810 | /* create initial colour map */ |
@@ -821,20 +824,13 @@ static int __devinit s3c_fb_probe_win(struct s3c_fb *sfb, unsigned int win_no, | |||
821 | ret = register_framebuffer(fbinfo); | 824 | ret = register_framebuffer(fbinfo); |
822 | if (ret < 0) { | 825 | if (ret < 0) { |
823 | dev_err(sfb->dev, "failed to register framebuffer\n"); | 826 | dev_err(sfb->dev, "failed to register framebuffer\n"); |
824 | goto err_alloc_mem; | 827 | return ret; |
825 | } | 828 | } |
826 | 829 | ||
827 | *res = win; | 830 | *res = win; |
828 | dev_info(sfb->dev, "window %d: fb %s\n", win_no, fbinfo->fix.id); | 831 | dev_info(sfb->dev, "window %d: fb %s\n", win_no, fbinfo->fix.id); |
829 | 832 | ||
830 | return 0; | 833 | return 0; |
831 | |||
832 | err_alloc_mem: | ||
833 | s3c_fb_free_memory(sfb, win); | ||
834 | |||
835 | err_framebuffer: | ||
836 | unregister_framebuffer(fbinfo); | ||
837 | return ret; | ||
838 | } | 834 | } |
839 | 835 | ||
840 | /** | 836 | /** |