drm: Avoid calling dev_printk(.dev = NULL)
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 19 Aug 2016 07:37:50 +0000 (08:37 +0100)
committerSean Paul <seanpaul@chromium.org>
Mon, 22 Aug 2016 16:05:06 +0000 (12:05 -0400)
Since dev_printk likes to print "(NULL device *):" when passed in a NULL
pointer, we have to manually call printk() ourselves.

Fixes: c4e68a583202 ("drm: Introduce DRM_DEV_* log messages")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Eric Engestrom <eric.engestrom@imgtec.com>
Cc: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20160819073750.16610-1-chris@chris-wilson.co.uk
drivers/gpu/drm/drm_drv.c

index a7f6282..acf6a5f 100644 (file)
@@ -79,8 +79,11 @@ void drm_dev_printk(const struct device *dev, const char *level,
        vaf.fmt = format;
        vaf.va = &args;
 
-       dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
-                  &vaf);
+       if (dev)
+               dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
+                          &vaf);
+       else
+               printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
 
        va_end(args);
 }