]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: vim2m: don't use curr_ctx->dev before checking
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 7 Feb 2019 17:28:19 +0000 (12:28 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 7 Feb 2019 17:29:21 +0000 (12:29 -0500)
It seems that it is possible that dev to be null, as there's
a warning printing:
"Instance released before the end of transaction"

Solves this warning:
drivers/media/platform/vim2m.c: drivers/media/platform/vim2m.c:525 device_work() warn: variable dereferenced before check 'curr_ctx' (see line 523)

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/vim2m.c

index bfa1a2a1600925f788ba05606b35209f7f92d714..bd125ad34343cf74461abd66aa50ba27583efd39 100644 (file)
@@ -520,13 +520,14 @@ static void device_work(struct work_struct *w)
        unsigned long flags;
 
        curr_ctx = container_of(w, struct vim2m_ctx, work_run.work);
-       vim2m_dev = curr_ctx->dev;
 
        if (NULL == curr_ctx) {
                pr_err("Instance released before the end of transaction\n");
                return;
        }
 
+       vim2m_dev = curr_ctx->dev;
+
        src_vb = v4l2_m2m_src_buf_remove(curr_ctx->fh.m2m_ctx);
        dst_vb = v4l2_m2m_dst_buf_remove(curr_ctx->fh.m2m_ctx);