drm/amd/display: Fix color module crash when hotplug monitors.
authorAnthony Koo <Anthony.Koo@amd.com>
Fri, 23 Dec 2016 20:43:04 +0000 (15:43 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 21:07:54 +0000 (17:07 -0400)
commitafed48a00c26cb6cbe2cfe72ce459dc3e13b42d4
tree0f29c9580d4871c89f4e587418fe1064a7b6a1f4
parent5a7a1eebc6199a8e19cc6497cffb3e16d9d55333
drm/amd/display: Fix color module crash when hotplug monitors.

Assume we have two monitors, and monitor 0 is unplugged.
This shifts the internal state of index 1 to index 0 by memcpy.
This means there are two copies of the gamma pointer previously
owned by state[1].

When hotplug occurs, this re-assigns the new display with state[1],
which has some garbage left over from before, including the
gamma pointer.

We should correctly clear unused states and re-initialize correctly.

Also, due to async nature of the hotplug and other events like commit,
we also need to safe guard against sink that has been removed.

Signed-off-by: Anthony Koo <anthony.koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/modules/color/color.c