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

media: adv7842: remove spurious & and fix vga_edid size

No need to use & to get the start address of an array.

Fix the size of vga_edid.edid to a single block (128 bytes) to fix
this smatch error:

adv7842.c:2538 adv7842_set_edid() error: memcpy() '&state->vga_edid.edid' too small (128 vs 512)

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
7629cbd6 00ae4ebc

+4 -4
+4 -4
drivers/media/i2c/adv7842.c
··· 2531 2531 2532 2532 switch (e->pad) { 2533 2533 case ADV7842_EDID_PORT_VGA: 2534 - memset(&state->vga_edid.edid, 0, sizeof(state->vga_edid.edid)); 2534 + memset(state->vga_edid.edid, 0, sizeof(state->vga_edid.edid)); 2535 2535 state->vga_edid.blocks = e->blocks; 2536 2536 state->vga_edid.present = e->blocks ? 0x1 : 0x0; 2537 2537 if (e->blocks) 2538 - memcpy(&state->vga_edid.edid, e->edid, 128 * e->blocks); 2538 + memcpy(state->vga_edid.edid, e->edid, 128); 2539 2539 err = edid_write_vga_segment(sd); 2540 2540 break; 2541 2541 case ADV7842_EDID_PORT_A: 2542 2542 case ADV7842_EDID_PORT_B: 2543 - memset(&state->hdmi_edid.edid, 0, sizeof(state->hdmi_edid.edid)); 2543 + memset(state->hdmi_edid.edid, 0, sizeof(state->hdmi_edid.edid)); 2544 2544 state->hdmi_edid.blocks = e->blocks; 2545 2545 if (e->blocks) { 2546 2546 state->hdmi_edid.present |= 0x04 << e->pad; 2547 - memcpy(&state->hdmi_edid.edid, e->edid, 128 * e->blocks); 2547 + memcpy(state->hdmi_edid.edid, e->edid, 128 * e->blocks); 2548 2548 } else { 2549 2549 state->hdmi_edid.present &= ~(0x04 << e->pad); 2550 2550 adv7842_s_detect_tx_5v_ctrl(sd);