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

[media] media: au0828 set ctrl_input in au0828_s_input()

dev->ctrl_input is set in vidioc_s_input() and doesn't get set in
au0828_s_input(). As a result, dev->ctrl_input is left uninitialized
until user space calls s_input.

It works correctly because the default input value is 0 and which is
what dev->ctrl_input gets initialized via kzalloc().

Change to set dev->ctrl_input in au0828_s_input(). Also optimize
vidioc_s_input() to return if the new input value is same as the
current.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Shuah Khan and committed by
Mauro Carvalho Chehab
174ced21 b21d29e0

+8 -2
+8 -2
drivers/media/usb/au0828/au0828-video.c
··· 1417 1417 default: 1418 1418 dprintk(1, "unknown input type set [%d]\n", 1419 1419 AUVI_INPUT(index).type); 1420 - break; 1420 + return; 1421 1421 } 1422 + 1423 + dev->ctrl_input = index; 1422 1424 1423 1425 v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, 1424 1426 AUVI_INPUT(index).vmux, 0, 0); ··· 1460 1458 return -EINVAL; 1461 1459 if (AUVI_INPUT(index).type == 0) 1462 1460 return -EINVAL; 1463 - dev->ctrl_input = index; 1461 + 1462 + if (dev->ctrl_input == index) 1463 + return 0; 1464 + 1464 1465 au0828_s_input(dev, index); 1465 1466 return 0; 1466 1467 } ··· 1979 1974 dev->ctrl_ainput = 0; 1980 1975 dev->ctrl_freq = 960; 1981 1976 dev->std = V4L2_STD_NTSC_M; 1977 + /* Default input is TV Tuner */ 1982 1978 au0828_s_input(dev, 0); 1983 1979 1984 1980 mutex_init(&dev->vb_queue_lock);