staging: drm/omap: Validate debugfs device
authorAndy Gross <andy.gross@ti.com>
Mon, 5 Mar 2012 16:48:38 +0000 (10:48 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Mar 2012 21:38:07 +0000 (13:38 -0800)
Added check for valid device information before dumping debugfs
information.

Signed-off-by: Andy Gross <andy.gross@ti.com>
Signed-off-by: Rob Clark <rob@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/omapdrm/omap_dmm_tiler.c

index 852d9440f7258c69a003563fbe4ba22528084d82..e4c7bb6afce4241718ba3318253bd44ec91de4b1 100644 (file)
@@ -766,10 +766,18 @@ int tiler_map_show(struct seq_file *s, void *arg)
        const char *a2d = special;
        const char *m2dp = m2d, *a2dp = a2d;
        char nice[128];
-       int h_adj = omap_dmm->lut_height / ydiv;
-       int w_adj = omap_dmm->lut_width / xdiv;
+       int h_adj;
+       int w_adj;
        unsigned long flags;
 
+       if (!omap_dmm) {
+               /* early return if dmm/tiler device is not initialized */
+               return 0;
+       }
+
+       h_adj = omap_dmm->lut_height / ydiv;
+       w_adj = omap_dmm->lut_width / xdiv;
+
        map = kzalloc(h_adj * sizeof(*map), GFP_KERNEL);
        global_map = kzalloc((w_adj + 1) * h_adj, GFP_KERNEL);