pwm_level_max maybe 0 we do throw a warning but move ahead with
execution which may later cause a /0 error.

--v2
-return if the warn_on gets hit [Jani]

Signed-off-by: Suraj Kandpal <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_backlight.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_backlight.c 
b/drivers/gpu/drm/i915/display/intel_backlight.c
index e007380e9a63..3b14f929825a 100644
--- a/drivers/gpu/drm/i915/display/intel_backlight.c
+++ b/drivers/gpu/drm/i915/display/intel_backlight.c
@@ -236,7 +236,8 @@ static void i9xx_set_backlight(const struct 
drm_connector_state *conn_state, u32
        struct intel_panel *panel = &connector->panel;
        u32 tmp, mask;
 
-       drm_WARN_ON(display->drm, panel->backlight.pwm_level_max == 0);
+       if (drm_WARN_ON(display->drm, panel->backlight.pwm_level_max == 0))
+               return;
 
        if (panel->backlight.combination_mode) {
                struct pci_dev *pdev = to_pci_dev(display->drm->dev);
-- 
2.34.1

Reply via email to