[RFC 11/12] [media] tc358743: don't return E2BIG from G_EDID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



E2BIG is meant to be returned by S_EDID if userspace provided more data than
the hardware can handle. If userspace requested too much data with G_EDID, we
should silently correct the number of EDID blocks downwards.

Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
---
 drivers/media/i2c/tc358743.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index 02b131b..7d70acc 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -1560,10 +1560,11 @@ static int tc358743_g_edid(struct v4l2_subdev *sd,
 	if (edid->blocks == 0)
 		return -EINVAL;
 
-	if (edid->start_block + edid->blocks > 8) {
-		edid->blocks = 8;
-		return -E2BIG;
-	}
+	if (edid->start_block >= 8)
+		return -EINVAL;
+
+	if (edid->start_block + edid->blocks > 8)
+		edid->blocks = 8 - edid->start_block;
 
 	if (!edid->edid)
 		return -EINVAL;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux