media: pci: cx23885: check cx23885_vdev_init() return
[ Upstream commit 15126b916e39b0cb67026b0af3c014bfeb1f76b3 ] cx23885_vdev_init() can return a NULL pointer, but that pointer is used in the next line without a check. Add a NULL pointer check and go to the error unwind if it is NULL. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: Sicong Huang <huangsicong@iie.ac.cn> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c08d02053b
commit
8e31b096e2
@@ -1297,6 +1297,10 @@ int cx23885_video_register(struct cx23885_dev *dev)
|
||||
/* register Video device */
|
||||
dev->video_dev = cx23885_vdev_init(dev, dev->pci,
|
||||
&cx23885_video_template, "video");
|
||||
if (!dev->video_dev) {
|
||||
err = -ENOMEM;
|
||||
goto fail_unreg;
|
||||
}
|
||||
dev->video_dev->queue = &dev->vb2_vidq;
|
||||
err = video_register_device(dev->video_dev, VFL_TYPE_GRABBER,
|
||||
video_nr[dev->nr]);
|
||||
@@ -1311,6 +1315,10 @@ int cx23885_video_register(struct cx23885_dev *dev)
|
||||
/* register VBI device */
|
||||
dev->vbi_dev = cx23885_vdev_init(dev, dev->pci,
|
||||
&cx23885_vbi_template, "vbi");
|
||||
if (!dev->vbi_dev) {
|
||||
err = -ENOMEM;
|
||||
goto fail_unreg;
|
||||
}
|
||||
dev->vbi_dev->queue = &dev->vb2_vbiq;
|
||||
err = video_register_device(dev->vbi_dev, VFL_TYPE_VBI,
|
||||
vbi_nr[dev->nr]);
|
||||
|
||||
Reference in New Issue
Block a user