[v11,16/19] media: venus: venc: fix compile error in venc_close

Message ID 1497544320-2269-17-git-send-email-stanimir.varbanov@linaro.org
State Accepted
Commit c3eb9e51c86bae9c482d28f9a73c06cf2ae6c73b
Headers show
Series
  • Qualcomm video decoder/encoder driver
Related show

Commit Message

Stanimir Varbanov June 15, 2017, 4:31 p.m.
This fixes the following compile error ocured when building
with gcc7:

drivers/media/platform/qcom/venus/venc.c:1150
venc_close() error: dereferencing freed memory 'inst'

by moving kfree as a last call.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

---
 drivers/media/platform/qcom/venus/venc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4

Patch

diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
index d5b4b5bf10a2..39748e7a08e4 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -1145,10 +1145,10 @@  static int venc_close(struct file *file)
 	mutex_destroy(&inst->lock);
 	v4l2_fh_del(&inst->fh);
 	v4l2_fh_exit(&inst->fh);
-	kfree(inst);
 
 	pm_runtime_put_sync(inst->core->dev_enc);
 
+	kfree(inst);
 	return 0;
 }