Commit c0026c7b authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Mauro Carvalho Chehab

[media] s5p-mfc: Fix clock management in s5p_mfc_release() function

Clock control indirectly requires access to MFC device, so call it only
if we are sure that the device exists in s5p_mfc_release function.
s5p_mfc_remove() calls s5p_mfc_final_pm(), which releases all PM related
resources, including clocks, so any call to clocks related functions
is not valid after s5p_mfc_final_pm().

Fixes: d695c12c ("[media] media: s5p-mfc fix invalid memory access from
s5p_mfc_release()")
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent c5086f13
......@@ -929,10 +929,11 @@ static int s5p_mfc_release(struct file *file)
mfc_debug_enter();
if (dev)
mutex_lock(&dev->mfc_mutex);
s5p_mfc_clock_on();
vb2_queue_release(&ctx->vq_src);
vb2_queue_release(&ctx->vq_dst);
if (dev) {
s5p_mfc_clock_on();
/* Mark context as idle */
clear_work_bit_irqsave(ctx);
/*
......@@ -954,9 +955,9 @@ static int s5p_mfc_release(struct file *file)
if (s5p_mfc_power_off() < 0)
mfc_err("Power off failed\n");
}
}
mfc_debug(2, "Shutting down clock\n");
s5p_mfc_clock_off();
}
if (dev)
dev->ctx[ctx->num] = NULL;
s5p_mfc_dec_ctrls_delete(ctx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment