summaryrefslogtreecommitdiff
path: root/drivers/media/pci/cx88
diff options
context:
space:
mode:
authorZhouyang Jia <jiazhouyang09@gmail.com>2018-06-11 10:41:58 +0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-06-28 14:54:27 +0300
commit6c8871baebc781f27ec9ccc1324afd9802941b11 (patch)
tree30ceb9c9b599ebd302f02627f2c03a430f602e95 /drivers/media/pci/cx88
parent7534122d60066a50859c422ced4636deb23760bf (diff)
downloadlinux-6c8871baebc781f27ec9ccc1324afd9802941b11.tar.xz
media: cx88: add error handling for snd_ctl_add
When snd_ctl_add fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling snd_ctl_add. Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/pci/cx88')
-rw-r--r--drivers/media/pci/cx88/cx88-alsa.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c
index e5c3387cd1e8..89a65478ae36 100644
--- a/drivers/media/pci/cx88/cx88-alsa.c
+++ b/drivers/media/pci/cx88/cx88-alsa.c
@@ -962,8 +962,11 @@ static int cx88_audio_initdev(struct pci_dev *pci,
goto error;
/* If there's a wm8775 then add a Line-In ALC switch */
- if (core->sd_wm8775)
- snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch, chip));
+ if (core->sd_wm8775) {
+ err = snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch, chip));
+ if (err < 0)
+ goto error;
+ }
strcpy(card->driver, "CX88x");
sprintf(card->shortname, "Conexant CX%x", pci->device);