Commit 25e057fd authored by Takeshi Yoshimura's avatar Takeshi Yoshimura Committed by Mauro Carvalho Chehab

[media] ddbridge: Do not free_irq() if request_irq() failed

My static checker detected that free_irq() is called even after
request_irq() failed in ddb_probe(). In this case, the kernel may try to
free dev->pdev->irq although the IRQ is not assigned. This event rarely
occurs, but always introduces a warning if it happens.

"goto fail1" always results in disabling enabled MSI and releasing a
requested IRQ. It seems like the former handling is necessary. So I added
a conditional branch before the free_irq() (stat == 0 means request_irq()
succeeds).
Signed-off-by: default avatarTakeshi Yoshimura <yos@sslab.ics.keio.ac.jp>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent ee8defec
...@@ -1630,7 +1630,8 @@ static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1630,7 +1630,8 @@ static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
printk(KERN_ERR "fail1\n"); printk(KERN_ERR "fail1\n");
if (dev->msi) if (dev->msi)
pci_disable_msi(dev->pdev); pci_disable_msi(dev->pdev);
free_irq(dev->pdev->irq, dev); if (stat == 0)
free_irq(dev->pdev->irq, dev);
fail: fail:
printk(KERN_ERR "fail\n"); printk(KERN_ERR "fail\n");
ddb_unmap(dev); ddb_unmap(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment