drm/msm/sde: add null checks to scaler3 lut setup

Plane state is set to NULL during color fill operations.
This patch adds checks to gracefully handle NULL plane
state during the scaler3 setup path.

CRs-Fixed: 2019301
Change-Id: I3ac5bd8f26e68afe559bf7c815da904392d3de13
Signed-off-by: Clarence Ip <cip@codeaurora.org>
diff --git a/drivers/gpu/drm/msm/sde/sde_plane.c b/drivers/gpu/drm/msm/sde/sde_plane.c
index 4e94807..9dc13a2 100644
--- a/drivers/gpu/drm/msm/sde/sde_plane.c
+++ b/drivers/gpu/drm/msm/sde/sde_plane.c
@@ -618,9 +618,20 @@
 static int _sde_plane_setup_scaler3_lut(struct sde_plane *psde,
 		struct sde_plane_state *pstate)
 {
-	struct sde_hw_scaler3_cfg *cfg = psde->scaler3_cfg;
+	struct sde_hw_scaler3_cfg *cfg;
 	int ret = 0;
 
+	if (!psde || !psde->scaler3_cfg) {
+		SDE_ERROR("invalid args\n");
+		return -EINVAL;
+	} else if (!pstate) {
+		/* pstate is expected to be null on forced color fill */
+		SDE_DEBUG("null pstate\n");
+		return -EINVAL;
+	}
+
+	cfg = psde->scaler3_cfg;
+
 	cfg->dir_lut = msm_property_get_blob(
 			&psde->property_info,
 			pstate->property_blobs, &cfg->dir_len,
@@ -1006,7 +1017,7 @@
 					psde->scaler3_cfg, fmt,
 					chroma_subsmpl_h, chroma_subsmpl_v);
 		}
-	} else if (!psde->pixel_ext_usr) {
+	} else if (!psde->pixel_ext_usr || !pstate) {
 		uint32_t deci_dim, i;
 
 		/* calculate default configuration for QSEED2 */
@@ -1713,8 +1724,8 @@
 	 * timing, and may not be moved to the atomic_update/mode_set functions.
 	 */
 	if (psde->is_error)
-		/* force white frame with 0% alpha pipe output on error */
-		_sde_plane_color_fill(psde, 0xFFFFFF, 0x0);
+		/* force white frame with 100% alpha pipe output on error */
+		_sde_plane_color_fill(psde, 0xFFFFFF, 0xFF);
 	else if (psde->color_fill & SDE_PLANE_COLOR_FILL_FLAG)
 		/* force 100% alpha */
 		_sde_plane_color_fill(psde, psde->color_fill, 0xFF);