summaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/ngene
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-28 15:02:07 +0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-30 18:33:06 +0200
commit5a4faee2d01b615011ceb65c656250e4e6a274ee (patch)
treebba63236f40fe0ec67f8996c119bfc47d36e2b06 /drivers/media/pci/ngene
parent[media] saa7134: fix indent issues (diff)
downloadlinux-5a4faee2d01b615011ceb65c656250e4e6a274ee.tar.xz
linux-5a4faee2d01b615011ceb65c656250e4e6a274ee.zip
[media] ngene: preventing dereferencing a NULL pointer
As reported by smatch: drivers/media/pci/ngene/ngene-core.c:1529 init_channel() error: we previously assumed 'chan->fe' could be null (see line 1521) Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/pci/ngene')
-rw-r--r--drivers/media/pci/ngene/ngene-core.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c
index e29bc3af4baf..1b92d836a564 100644
--- a/drivers/media/pci/ngene/ngene-core.c
+++ b/drivers/media/pci/ngene/ngene-core.c
@@ -1526,10 +1526,12 @@ static int init_channel(struct ngene_channel *chan)
if (chan->fe2) {
if (dvb_register_frontend(adapter, chan->fe2) < 0)
goto err;
- chan->fe2->tuner_priv = chan->fe->tuner_priv;
- memcpy(&chan->fe2->ops.tuner_ops,
- &chan->fe->ops.tuner_ops,
- sizeof(struct dvb_tuner_ops));
+ if (chan->fe) {
+ chan->fe2->tuner_priv = chan->fe->tuner_priv;
+ memcpy(&chan->fe2->ops.tuner_ops,
+ &chan->fe->ops.tuner_ops,
+ sizeof(struct dvb_tuner_ops));
+ }
}
if (chan->has_demux) {