[media] media-entity: only call dev_dbg_obj if mdev is not NULL
authorHelen Fornazier <helen.koike@collabora.com>
Thu, 6 Apr 2017 19:25:15 +0000 (16:25 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 19 Apr 2017 11:15:51 +0000 (08:15 -0300)
Fix kernel Oops NULL pointer deference
Call dev_dbg_obj only after checking if gobj->mdev is not NULL

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/media-entity.c

index 5640ca29da8c9bbc8ea63ce84077c087a0bb9557..bc44193efa4798b449bb0cd345fd4bdbd4c25b6e 100644 (file)
@@ -199,12 +199,12 @@ void media_gobj_create(struct media_device *mdev,
 
 void media_gobj_destroy(struct media_gobj *gobj)
 {
-       dev_dbg_obj(__func__, gobj);
-
        /* Do nothing if the object is not linked. */
        if (gobj->mdev == NULL)
                return;
 
+       dev_dbg_obj(__func__, gobj);
+
        gobj->mdev->topology_version++;
 
        /* Remove the object from mdev list */