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

[media] msi3101: check I/O return values on stop streaming

Coverity CID 1196496: Unchecked return value (CHECKED_RETURN)

Calling "msi3101_ctrl_msg" without checking return value (as is done
elsewhere 8 out of 10 times).

Reported-by: <scan-admin@coverity.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Antti Palosaari and committed by
Mauro Carvalho Chehab
cf2a320e 11da6ed6

+10 -4
+10 -4
drivers/staging/media/msi3101/sdr-msi3101.c
··· 1077 1077 static int msi3101_stop_streaming(struct vb2_queue *vq) 1078 1078 { 1079 1079 struct msi3101_state *s = vb2_get_drv_priv(vq); 1080 + int ret; 1080 1081 dev_dbg(&s->udev->dev, "%s:\n", __func__); 1081 1082 1082 1083 if (mutex_lock_interruptible(&s->v4l2_lock)) ··· 1090 1089 1091 1090 /* according to tests, at least 700us delay is required */ 1092 1091 msleep(20); 1093 - msi3101_ctrl_msg(s, CMD_STOP_STREAMING, 0); 1092 + ret = msi3101_ctrl_msg(s, CMD_STOP_STREAMING, 0); 1093 + if (ret) 1094 + goto err_sleep_tuner; 1094 1095 1095 1096 /* sleep USB IF / ADC */ 1096 - msi3101_ctrl_msg(s, CMD_WREG, 0x01000003); 1097 + ret = msi3101_ctrl_msg(s, CMD_WREG, 0x01000003); 1098 + if (ret) 1099 + goto err_sleep_tuner; 1097 1100 1101 + err_sleep_tuner: 1098 1102 /* sleep tuner */ 1099 - v4l2_subdev_call(s->v4l2_subdev, core, s_power, 0); 1103 + ret = v4l2_subdev_call(s->v4l2_subdev, core, s_power, 0); 1100 1104 1101 1105 mutex_unlock(&s->v4l2_lock); 1102 1106 1103 - return 0; 1107 + return ret; 1104 1108 } 1105 1109 1106 1110 static struct vb2_ops msi3101_vb2_ops = {