summaryrefslogtreecommitdiff
path: root/drivers/media/test-drivers/vidtv/vidtv_bridge.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-09-21 16:11:50 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-11-26 09:43:40 +0300
commit3be8037960bccd13052cfdeba8805ad785041d70 (patch)
tree61a614288890ceac66534306df68cf583360be42 /drivers/media/test-drivers/vidtv/vidtv_bridge.c
parent8922e3931dd79055bb3f851bed33f069fc67a2fc (diff)
downloadlinux-3be8037960bccd13052cfdeba8805ad785041d70.tar.xz
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>
Diffstat (limited to 'drivers/media/test-drivers/vidtv/vidtv_bridge.c')
-rw-r--r--drivers/media/test-drivers/vidtv/vidtv_bridge.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
index 068fb4e9fafe..e846aaab2c44 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c
+++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
@@ -185,6 +185,8 @@ static int vidtv_start_streaming(struct vidtv_dvb *dvb)
dvb->streaming = true;
dvb->mux = vidtv_mux_init(dvb->fe[0], dev, mux_args);
+ if (!dvb->mux)
+ return -ENOMEM;
vidtv_mux_start_thread(dvb->mux);
dev_dbg_ratelimited(dev, "Started streaming\n");