Skip to content

Commit 3df55cd

Browse files
Hans Verkuilmchehab
authored andcommitted
media: platform: mediatek: vpu: fix NULL ptr dereference
If pdev is NULL, then it is still dereferenced. This fixes this smatch warning: drivers/media/platform/mediatek/vpu/mtk_vpu.c:570 vpu_load_firmware() warn: address of NULL pointer 'pdev' Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Cc: Yunfei Dong <yunfei.dong@mediatek.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
1 parent 99f9cd2 commit 3df55cd

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/media/platform/mediatek/vpu/mtk_vpu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,15 +562,17 @@ static int load_requested_vpu(struct mtk_vpu *vpu,
562562
int vpu_load_firmware(struct platform_device *pdev)
563563
{
564564
struct mtk_vpu *vpu;
565-
struct device *dev = &pdev->dev;
565+
struct device *dev;
566566
struct vpu_run *run;
567567
int ret;
568568

569569
if (!pdev) {
570-
dev_err(dev, "VPU platform device is invalid\n");
570+
pr_err("VPU platform device is invalid\n");
571571
return -EINVAL;
572572
}
573573

574+
dev = &pdev->dev;
575+
574576
vpu = platform_get_drvdata(pdev);
575577
run = &vpu->run;
576578

0 commit comments

Comments
 (0)