media: mtk-vcodec: potential dereference of null pointer
The return value of devm_kzalloc() needs to be checked.
To avoid use of null pointer in case of thefailure of alloc.
Fixes: 46233e91fa
("media: mtk-vcodec: move firmware implementations into their own files")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Родитель
8310ca9407
Коммит
e25a89f743
|
@ -102,6 +102,8 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev,
|
|||
vpu_wdt_reg_handler(fw_pdev, mtk_vcodec_vpu_reset_handler, dev, rst_id);
|
||||
|
||||
fw = devm_kzalloc(&dev->plat_dev->dev, sizeof(*fw), GFP_KERNEL);
|
||||
if (!fw)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
fw->type = VPU;
|
||||
fw->ops = &mtk_vcodec_vpu_msg;
|
||||
fw->pdev = fw_pdev;
|
||||
|
|
Загрузка…
Ссылка в новой задаче