Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc147135 authored by Trent Piepho's avatar Trent Piepho Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (5900): usbvision: fix bugs [sg]_register functions



s_register was assigning the return code to (unsigned)reg->val, rather than
errCode, which it what it would return.  Except reg->val can't be < 0, so it
would never actually return an error.

g_register never actually put the value it read into reg->val.

Signed-off-by: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent cf784d55
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -517,6 +517,7 @@ static int vidioc_g_register (struct file *file, void *priv,
		    __FUNCTION__, errCode);
		return errCode;
	}
	reg->val = errCode;
	return 0;
}

@@ -531,8 +532,8 @@ static int vidioc_s_register (struct file *file, void *priv,
	if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
		return -EINVAL;
	/* NT100x has a 8-bit register space */
	reg->val = (u8)usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
	if (reg->val < 0) {
	errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
	if (errCode < 0) {
		err("%s: VIDIOC_DBG_S_REGISTER failed: error %d",
		    __FUNCTION__, errCode);
		return errCode;