V4L/DVB (12303): cx23885: check pointers before dereferencing in dprintk macro
authorMichael Krufky <mkrufky@kernellabs.com>
Sun, 19 Jul 2009 20:55:35 +0000 (17:55 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 24 Jul 2009 17:03:32 +0000 (14:03 -0300)
When enabling debug with v4l_debug set to 2 or greater, the driver
OOPS's on startup.  Checks dev pointer before dereferencing, in
order to prevent this OOPS.

Signed-off-by: Michael Krufky <mkrufky@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx23885/cx23885-417.c

index 2ea7181ae8fb8e85f9346ad6ba36d7302ab58810..e0cf21e0b1bf52e3649841a6405d70ed3c4859ef 100644 (file)
@@ -58,7 +58,8 @@ MODULE_PARM_DESC(v4l_debug, "enable V4L debug messages");
 
 #define dprintk(level, fmt, arg...)\
        do { if (v4l_debug >= level) \
-               printk(KERN_DEBUG "%s: " fmt, dev->name , ## arg);\
+               printk(KERN_DEBUG "%s: " fmt, \
+               (dev) ? dev->name : "cx23885[?]", ## arg); \
        } while (0)
 
 static struct cx23885_tvnorm cx23885_tvnorms[] = {