[PATCH] intelfb: Fix oops when changing video mode
authorAntonino A. Daplas <adaplas@gmail.com>
Mon, 19 Dec 2005 07:11:49 +0000 (15:11 +0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 20 Dec 2005 17:27:15 +0000 (09:27 -0800)
Reported by: janis huang (Bugzilla Bug 5747)

Fix on oops in intelfb.  Not sure what's happening, looks like
dinfo->name pointer is invalidated after initialization.  Remove
intelfb_get_fix, it's not needed and move the majority of the code to
the initialization routine.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/video/intelfb/intelfbdrv.c

index ac8d6617095e5c170bab85fef5c747116f818e52..0090544842f5d672225b127c9f69f53ec31ebe63 100644 (file)
 static void __devinit get_initial_mode(struct intelfb_info *dinfo);
 static void update_dinfo(struct intelfb_info *dinfo,
                         struct fb_var_screeninfo *var);
-static int intelfb_get_fix(struct fb_fix_screeninfo *fix,
-                          struct fb_info *info);
-
 static int intelfb_check_var(struct fb_var_screeninfo *var,
                             struct fb_info *info);
 static int intelfb_set_par(struct fb_info *info);
@@ -1096,7 +1093,17 @@ intelfb_set_fbinfo(struct intelfb_info *dinfo)
                return 1;
 
        info->pixmap.scan_align = 1;
-
+       strcpy(info->fix.id, dinfo->name);
+       info->fix.smem_start = dinfo->fb.physical;
+       info->fix.smem_len = dinfo->fb.size;
+       info->fix.type = FB_TYPE_PACKED_PIXELS;
+       info->fix.type_aux = 0;
+       info->fix.xpanstep = 8;
+       info->fix.ypanstep = 1;
+       info->fix.ywrapstep = 0;
+       info->fix.mmio_start = dinfo->mmio_base_phys;
+       info->fix.mmio_len = INTEL_REG_SIZE;
+       info->fix.accel = FB_ACCEL_I830;
        update_dinfo(dinfo, &info->var);
 
        return 0;
@@ -1114,7 +1121,8 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var)
        dinfo->yres = var->xres;
        dinfo->pixclock = var->pixclock;
 
-       intelfb_get_fix(&dinfo->info->fix, dinfo->info);
+       dinfo->info->fix.visual = dinfo->visual;
+       dinfo->info->fix.line_length = dinfo->pitch;
 
        switch (dinfo->bpp) {
        case 8:
@@ -1144,30 +1152,6 @@ update_dinfo(struct intelfb_info *dinfo, struct fb_var_screeninfo *var)
 
 /* fbops functions */
 
-static int
-intelfb_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info)
-{
-       struct intelfb_info *dinfo = GET_DINFO(info);
-
-       DBG_MSG("intelfb_get_fix\n");
-
-       memset(fix, 0, sizeof(*fix));
-       strcpy(fix->id, dinfo->name);
-       fix->smem_start = dinfo->fb.physical;
-       fix->smem_len = dinfo->fb.size;
-       fix->type = FB_TYPE_PACKED_PIXELS;
-       fix->type_aux = 0;
-       fix->visual = dinfo->visual;
-       fix->xpanstep = 8;
-       fix->ypanstep = 1;
-       fix->ywrapstep = 0;
-       fix->line_length = dinfo->pitch;
-       fix->mmio_start = dinfo->mmio_base_phys;
-       fix->mmio_len = INTEL_REG_SIZE;
-       fix->accel = FB_ACCEL_I830;
-       return 0;
-}
-
 /***************************************************************
  *                       fbdev interface                       *
  ***************************************************************/