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>