mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-07 00:59:06 +00:00
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>
This commit is contained in:
parent
99f9cd2e25
commit
3df55cd773
1 changed files with 4 additions and 2 deletions
|
@ -562,15 +562,17 @@ static int load_requested_vpu(struct mtk_vpu *vpu,
|
||||||
int vpu_load_firmware(struct platform_device *pdev)
|
int vpu_load_firmware(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct mtk_vpu *vpu;
|
struct mtk_vpu *vpu;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev;
|
||||||
struct vpu_run *run;
|
struct vpu_run *run;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!pdev) {
|
if (!pdev) {
|
||||||
dev_err(dev, "VPU platform device is invalid\n");
|
pr_err("VPU platform device is invalid\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dev = &pdev->dev;
|
||||||
|
|
||||||
vpu = platform_get_drvdata(pdev);
|
vpu = platform_get_drvdata(pdev);
|
||||||
run = &vpu->run;
|
run = &vpu->run;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue