media: tw686x: Fix oops on buffer alloc failure
authorKrzysztof Ha?asa <khalasa@piap.pl>
Thu, 28 Jun 2018 21:45:07 +0000 (17:45 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 25 Jul 2018 12:34:28 +0000 (08:34 -0400)
commit5a1a2f63d840dc2631505b607e11ff65ac1b7d3c
treeb99b659788c801f75a04b59f728b5f71eb0f1de4
parentacbea6798955e92eefa5fb84ecaa677a763c8762
media: tw686x: Fix oops on buffer alloc failure

The error path currently calls tw686x_video_free() which requires
vc->dev to be initialized, causing a NULL dereference on uninitizalized
channels.

Fix this by setting the vc->dev fields for all the channels first.

Fixes: f8afaa8dbc0d ("[media] tw686x: Introduce an interface to support multiple DMA modes")

Signed-off-by: Krzysztof Ha?asa <khalasa@piap.pl>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/pci/tw686x/tw686x-video.c