Skip to content

Commit

Permalink
media: cx88: Fix some error handling path in 'cx8800_initdev()'
Browse files Browse the repository at this point in the history
A call to 'pci_disable_device()' is missing in the error handling path.
In some cases, a call to 'free_irq()' may also be missing.

Reorder the error handling path, add some new labels and fix the 2 issues
mentionned above.

This way, the error handling path in more in line with 'cx8800_finidev()'
(i.e. the remove function)

Signed-off-by: Christophe JAILLET <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
tititiou36 authored and mchehab committed Oct 10, 2019
1 parent 2eca8e4 commit e1444e9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/media/pci/cx88/cx88-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
core = cx88_core_get(dev->pci);
if (!core) {
err = -EINVAL;
goto fail_free;
goto fail_disable;
}
dev->core = core;

Expand Down Expand Up @@ -1323,7 +1323,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
cc->step, cc->default_value);
if (!vc) {
err = core->audio_hdl.error;
goto fail_core;
goto fail_irq;
}
vc->priv = (void *)cc;
}
Expand All @@ -1337,7 +1337,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev,
cc->step, cc->default_value);
if (!vc) {
err = core->video_hdl.error;
goto fail_core;
goto fail_irq;
}
vc->priv = (void *)cc;
if (vc->id == V4L2_CID_CHROMA_AGC)
Expand Down Expand Up @@ -1509,11 +1509,14 @@ static int cx8800_initdev(struct pci_dev *pci_dev,

fail_unreg:
cx8800_unregister_video(dev);
free_irq(pci_dev->irq, dev);
mutex_unlock(&core->lock);
fail_irq:
free_irq(pci_dev->irq, dev);
fail_core:
core->v4ldev = NULL;
cx88_core_put(core, dev->pci);
fail_disable:
pci_disable_device(pci_dev);
fail_free:
kfree(dev);
return err;
Expand Down

0 comments on commit e1444e9

Please sign in to comment.