media: vidtv: add error checks
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 21 Sep 2020 13:11:50 +0000 (15:11 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 26 Nov 2020 06:43:40 +0000 (07:43 +0100)
commit3be8037960bccd13052cfdeba8805ad785041d70
tree61a614288890ceac66534306df68cf583360be42
parent8922e3931dd79055bb3f851bed33f069fc67a2fc
media: vidtv: add error checks

Currently, there are not checks if something gets bad during
memory allocation: it will simply use NULL pointers and
crash.

Add error path at the logic which allocates memory for the
MPEG-TS generator code, propagating the errors up to the
vidtv_bridge. Now, if something wents bad, start_streaming
will return an error that userspace can detect:

ERROR    DMX_SET_PES_FILTER failed (PID = 0x2000): 12 Cannot allocate memory

and the driver doesn't crash.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/test-drivers/vidtv/vidtv_bridge.c
drivers/media/test-drivers/vidtv/vidtv_channel.c
drivers/media/test-drivers/vidtv/vidtv_channel.h
drivers/media/test-drivers/vidtv/vidtv_mux.c
drivers/media/test-drivers/vidtv/vidtv_psi.c
drivers/media/test-drivers/vidtv/vidtv_s302m.c