Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

V4L/DVB: cx231xx: improve error handling

Return -EINVAL if we don't find the control id.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Dan Carpenter and committed by
Mauro Carvalho Chehab
8e47567f f7628015

+4 -1
+4 -1
drivers/media/video/cx231xx/cx231xx-video.c
··· 1902 1902 if (c->id < V4L2_CID_BASE || c->id >= V4L2_CID_LASTP1) 1903 1903 return -EINVAL; 1904 1904 if (c->id == V4L2_CID_AUDIO_MUTE) { 1905 - for (i = 0; i < CX231XX_CTLS; i++) 1905 + for (i = 0; i < CX231XX_CTLS; i++) { 1906 1906 if (cx231xx_ctls[i].v.id == c->id) 1907 1907 break; 1908 + } 1909 + if (i == CX231XX_CTLS) 1910 + return -EINVAL; 1908 1911 *c = cx231xx_ctls[i].v; 1909 1912 } else 1910 1913 *c = no_ctl;