]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/i915/backlight: Fix divide by 0 error in i9xx_set_backlight
authorSuraj Kandpal <suraj.kandpal@intel.com>
Tue, 19 Aug 2025 16:04:39 +0000 (21:34 +0530)
committerSuraj Kandpal <suraj.kandpal@intel.com>
Thu, 21 Aug 2025 04:15:10 +0000 (09:45 +0530)
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 <suraj.kandpal@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://lore.kernel.org/r/20250819160438.145734-1-suraj.kandpal@intel.com
drivers/gpu/drm/i915/display/intel_backlight.c

index e007380e9a6311f3762c75f1a81d9d0326287ae7..3b14f929825a13b9fef7349da0a2e1dd8d48ce20 100644 (file)
@@ -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);