diff options
author | Daniel Scheller | 2017-08-12 13:55:56 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab | 2017-08-20 13:06:51 +0200 |
commit | f597f2a8fce27b067ed5ad58314bdfbb219d2ffe (patch) | |
tree | 46bc3133c642f7ffbf68afa091e8f7aed54693c1 /drivers/media/pci/ddbridge | |
parent | media: ddbridge: check pointers before dereferencing (diff) | |
download | kernel-qcow2-linux-f597f2a8fce27b067ed5ad58314bdfbb219d2ffe.tar.gz kernel-qcow2-linux-f597f2a8fce27b067ed5ad58314bdfbb219d2ffe.tar.xz kernel-qcow2-linux-f597f2a8fce27b067ed5ad58314bdfbb219d2ffe.zip |
media: ddbridge: only register frontends in fe2 if fe is not NULL
Smatch reported:
drivers/media/pci/ddbridge/ddbridge-core.c:1602 dvb_input_attach() error: we previously assumed 'dvb->fe' could be null (see line 1595)
dvb->fe2 will ever only be populated when dvb->fe is set. So only handle
registration of dvb->fe2 when dvb->fe got set beforehand by moving the
registration into the "if (dvb->fe)" conditional.
Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Tested-by: Jasmin Jessich <jasmin@anw.at>
Tested-by: Dietmar Spingler <d_spingler@freenet.de>
Tested-by: Manfred Knick <Manfred.Knick@t-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/pci/ddbridge')
-rw-r--r-- | drivers/media/pci/ddbridge/ddbridge-core.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index d7bf01f38d98..759a53e82252 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -1506,23 +1506,25 @@ static int dvb_input_attach(struct ddb_input *input) return 0; } dvb->attached = 0x30; + if (dvb->fe) { if (dvb_register_frontend(adap, dvb->fe) < 0) return -ENODEV; + + if (dvb->fe2) { + if (dvb_register_frontend(adap, dvb->fe2) < 0) + return -ENODEV; + dvb->fe2->tuner_priv = dvb->fe->tuner_priv; + memcpy(&dvb->fe2->ops.tuner_ops, + &dvb->fe->ops.tuner_ops, + sizeof(struct dvb_tuner_ops)); + } } - if (dvb->fe2) { - if (dvb_register_frontend(adap, dvb->fe2) < 0) - return -ENODEV; - dvb->fe2->tuner_priv = dvb->fe->tuner_priv; - memcpy(&dvb->fe2->ops.tuner_ops, - &dvb->fe->ops.tuner_ops, - sizeof(struct dvb_tuner_ops)); - } + dvb->attached = 0x31; return 0; } - static int port_has_encti(struct ddb_port *port) { struct device *dev = port->dev->dev; |