Commit 211eba9e authored by Colin Ian King's avatar Colin Ian King Committed by Mauro Carvalho Chehab
Browse files

[media] VPU: mediatek: fix null pointer dereference on pdev

pdev is being null checked, however, prior to that it is being
dereferenced by platform_get_drvdata.  Move the assignments of
vpu and run to after the pdev null check to avoid a potential
null pointer dereference.

Signed-off-by: default avatarColin Ian King <>
Reviewed-by: default avatarTiffany Lin <>
Signed-off-by: default avatarHans Verkuil <>
Signed-off-by: default avatarMauro Carvalho Chehab <>
parent 67712beb
......@@ -534,9 +534,9 @@ static int load_requested_vpu(struct mtk_vpu *vpu,
int vpu_load_firmware(struct platform_device *pdev)
struct mtk_vpu *vpu = platform_get_drvdata(pdev);
struct mtk_vpu *vpu;
struct device *dev = &pdev->dev;
struct vpu_run *run = &vpu->run;
struct vpu_run *run;
const struct firmware *vpu_fw = NULL;
int ret;
......@@ -545,6 +545,9 @@ int vpu_load_firmware(struct platform_device *pdev)
return -EINVAL;
vpu = platform_get_drvdata(pdev);
run = &vpu->run;
if (vpu->fw_loaded) {
Supports Markdown
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