diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2021-03-26 10:03:32 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2021-04-06 19:35:26 +0200 |
commit | b24bc3ab010970e976dc363d2ca0796516d0d763 (patch) | |
tree | 48d57f078df4f81c5b0dd23a70a851ecff6e9f2b /drivers/media/i2c | |
parent | c730ff32b917c814c1d86343328f0518a94114c0 (diff) | |
download | linux-b24bc3ab010970e976dc363d2ca0796516d0d763.tar.bz2 |
media: adv7511-v4l2: correctly report EDIDs of 1 block
If the EDID has an odd number of blocks (usually just 1, but the
same problem occurs with 3 blocks), then VIDIOC_G_EDID reported 2
(or 4) blocks. Fix this.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/adv7511-v4l2.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/media/i2c/adv7511-v4l2.c b/drivers/media/i2c/adv7511-v4l2.c index 9183003ae22d..992db5c79b13 100644 --- a/drivers/media/i2c/adv7511-v4l2.c +++ b/drivers/media/i2c/adv7511-v4l2.c @@ -1196,21 +1196,21 @@ static int adv7511_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) return -EINVAL; if (edid->start_block == 0 && edid->blocks == 0) { - edid->blocks = state->edid.segments * 2; + edid->blocks = state->edid.blocks; return 0; } - if (state->edid.segments == 0) + if (state->edid.blocks == 0) return -ENODATA; - if (edid->start_block >= state->edid.segments * 2) + if (edid->start_block >= state->edid.blocks) return -EINVAL; - if (edid->start_block + edid->blocks > state->edid.segments * 2) - edid->blocks = state->edid.segments * 2 - edid->start_block; + if (edid->start_block + edid->blocks > state->edid.blocks) + edid->blocks = state->edid.blocks - edid->start_block; memcpy(edid->edid, &state->edid.data[edid->start_block * 128], - 128 * edid->blocks); + 128 * edid->blocks); return 0; } |