Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/backlight: Fix divide by 0 error in i9xx_set_backlight

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

+2 -1
+2 -1
drivers/gpu/drm/i915/display/intel_backlight.c
··· 236 236 struct intel_panel *panel = &connector->panel; 237 237 u32 tmp, mask; 238 238 239 - drm_WARN_ON(display->drm, panel->backlight.pwm_level_max == 0); 239 + if (drm_WARN_ON(display->drm, panel->backlight.pwm_level_max == 0)) 240 + return; 240 241 241 242 if (panel->backlight.combination_mode) { 242 243 struct pci_dev *pdev = to_pci_dev(display->drm->dev);