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

Commit ed356f11 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

media: vivid: check if the cec_adapter is valid



If CEC is not enabled for the vivid driver, then the adap pointer is NULL
and 'adap->phys_addr' will fail.

Cc: <stable@vger.kernel.org>      # for v4.12 and up
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 290ef7d8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -862,6 +862,7 @@ int vidioc_g_edid(struct file *file, void *_fh,
		return -EINVAL;
	if (edid->start_block + edid->blocks > dev->edid_blocks)
		edid->blocks = dev->edid_blocks - edid->start_block;
	if (adap)
		cec_set_edid_phys_addr(dev->edid, dev->edid_blocks * 128, adap->phys_addr);
	memcpy(edid->edid, dev->edid + edid->start_block * 128, edid->blocks * 128);
	return 0;