]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
video: fbdev: au1200fb: Fix error handling path
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Thu, 9 Nov 2017 17:09:29 +0000 (18:09 +0100)
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Thu, 9 Nov 2017 17:09:29 +0000 (18:09 +0100)
Rewrite the exit path based on 'au1200fb_drv_remove()'.
We can safely iterate for all already handled planes. Even if not
completely initialized, the functions that are called will silently accept
the 'fb_info' structure that is passed.

As soon as we find a NULL in the '_au1200fb_infos' array, we know that we
have released all what we needed to release. So we can 'break'.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
drivers/video/fbdev/au1200fb.c

index 0d8ed0ef9183952a647330bf7358e7dda57b157a..e531543bc7071461557d31e6673d50a65b38827b 100644 (file)
@@ -1760,11 +1760,19 @@ static int au1200fb_drv_probe(struct platform_device *dev)
        return 0;
 
 failed:
-       /* NOTE: This only does the current plane/window that failed; others are still active */
-       if (fbi) {
+       for (plane = 0; plane < device_count; ++plane) {
+               fbi = _au1200fb_infos[plane];
+               if (!fbi)
+                       break;
+
+               /* Clean up all probe data */
+               unregister_framebuffer(fbi);
                if (fbi->cmap.len != 0)
                        fb_dealloc_cmap(&fbi->cmap);
                kfree(fbi->pseudo_palette);
+
+               framebuffer_release(fbi);
+               _au1200fb_infos[plane] = NULL;
        }
        return ret;
 }