From 7b76eb582d6e6de0fe28f481c4f41e8e05a61819 Mon Sep 17 00:00:00 2001 From: Satya Rama Aditya Pinapala Date: Fri, 19 Jul 2019 12:36:14 -0700 Subject: [PATCH] disp: msm: dsi: deny an ESD trigger when not enabled During an ESD trigger, a check must be done to ensure that ESD is enabled on the particular panel. If not the panel might end up in a bad state, if the trigger is propagated successfully instead of reporting a failure. Change-Id: I310578e7136301ab75ba7f44f14d36ed7e6a519c Signed-off-by: Satya Rama Aditya Pinapala --- msm/dsi/dsi_display.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index 9808b2ed72..844e8ad66d 100644 --- a/msm/dsi/dsi_display.c +++ b/msm/dsi/dsi_display.c @@ -1259,6 +1259,7 @@ static ssize_t debugfs_esd_trigger_check(struct file *file, struct dsi_display *display = file->private_data; char *buf; int rc = 0; + struct drm_panel_esd_config *esd_config = &display->panel->esd_config; u32 esd_trigger; size_t len; @@ -1278,6 +1279,11 @@ static ssize_t debugfs_esd_trigger_check(struct file *file, atomic_read(&display->panel->esd_recovery_pending)) return user_len; + if (!esd_config->esd_enabled) { + DSI_ERR("ESD feature is not enabled\n"); + return -EINVAL; + } + buf = kzalloc(ESD_TRIGGER_STRING_MAX_LEN, GFP_KERNEL); if (!buf) return -ENOMEM;