V4L/DVB (3738): Saa7134: Fix oops with disable_ir=1

When disable_ir=1 parameter is used, or when saa7134_input_init1()
fails for any other reason, dev->remote will remain NULL, and the
driver will oops in saa7134_hwinit2().  Therefore dev->remote must be
checked before dereferencing.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
Sergey Vlasov 2006-04-07 10:04:56 -03:00 committed by Mauro Carvalho Chehab
parent a7286033f9
commit 7a766f9ddd
1 changed files with 5 additions and 1 deletions

View File

@ -548,6 +548,8 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs)
if (report & SAA7134_IRQ_REPORT_GPIO16) { if (report & SAA7134_IRQ_REPORT_GPIO16) {
switch (dev->has_remote) { switch (dev->has_remote) {
case SAA7134_REMOTE_GPIO: case SAA7134_REMOTE_GPIO:
if (!dev->remote)
break;
if (dev->remote->mask_keydown & 0x10000) { if (dev->remote->mask_keydown & 0x10000) {
saa7134_input_irq(dev); saa7134_input_irq(dev);
} }
@ -564,6 +566,8 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id, struct pt_regs *regs)
if (report & SAA7134_IRQ_REPORT_GPIO18) { if (report & SAA7134_IRQ_REPORT_GPIO18) {
switch (dev->has_remote) { switch (dev->has_remote) {
case SAA7134_REMOTE_GPIO: case SAA7134_REMOTE_GPIO:
if (!dev->remote)
break;
if ((dev->remote->mask_keydown & 0x40000) || if ((dev->remote->mask_keydown & 0x40000) ||
(dev->remote->mask_keyup & 0x40000)) { (dev->remote->mask_keyup & 0x40000)) {
saa7134_input_irq(dev); saa7134_input_irq(dev);
@ -676,7 +680,7 @@ static int saa7134_hwinit2(struct saa7134_dev *dev)
SAA7134_IRQ2_INTE_PE | SAA7134_IRQ2_INTE_PE |
SAA7134_IRQ2_INTE_AR; SAA7134_IRQ2_INTE_AR;
if (dev->has_remote == SAA7134_REMOTE_GPIO) { if (dev->has_remote == SAA7134_REMOTE_GPIO && dev->remote) {
if (dev->remote->mask_keydown & 0x10000) if (dev->remote->mask_keydown & 0x10000)
irq2_mask |= SAA7134_IRQ2_INTE_GPIO16; irq2_mask |= SAA7134_IRQ2_INTE_GPIO16;
else if (dev->remote->mask_keydown & 0x40000) else if (dev->remote->mask_keydown & 0x40000)