mx6: video_skip: Fix crash on NULL pointer
authorNikolay Dimitrov <picmaster@mail.bg>
Wed, 5 Nov 2014 08:55:33 +0000 (10:55 +0200)
committerStefano Babic <sbabic@denx.de>
Thu, 13 Nov 2014 16:56:15 +0000 (17:56 +0100)
Signed-off-by: Nikolay Dimitrov <picmaster@mail.bg>
Cc: Stefano Babic <sbabic@denx.de>
arch/arm/imx-common/video.c

index 8651b80ce0672f86334b7034fe27b889d30d2080..46f8a1e1dc1f20e99d580d20d2a04c8873c9019d 100644 (file)
@@ -11,6 +11,7 @@ int board_video_skip(void)
        int i;
        int ret;
        char const *panel = getenv("panel");
+
        if (!panel) {
                for (i = 0; i < display_count; i++) {
                        struct display_info_t const *dev = displays+i;
@@ -31,11 +32,14 @@ int board_video_skip(void)
                                break;
                }
        }
+
        if (i < display_count) {
                ret = ipuv3_fb_init(&displays[i].mode, 0,
                                    displays[i].pixfmt);
                if (!ret) {
-                       displays[i].enable(displays+i);
+                       if (displays[i].enable)
+                               displays[i].enable(displays + i);
+
                        printf("Display: %s (%ux%u)\n",
                               displays[i].mode.name,
                               displays[i].mode.xres,