From: Ben Skeggs Date: Mon, 23 Jan 2012 02:58:33 +0000 (+1000) Subject: drm/nouveau/pm: avoid potential divide-by-zero X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3d8a408c43828d586629204fe22134ae8f39b8be;p=linux-beck.git drm/nouveau/pm: avoid potential divide-by-zero Signed-off-by: Ben Skeggs Signed-off-by: Martin Peres --- diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index 08c563dfa28e..6e3851e1a1d7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c @@ -50,7 +50,7 @@ nouveau_pwmfan_get(struct drm_device *dev) ret = nouveau_gpio_find(dev, 0, DCB_GPIO_PWM_FAN, 0xff, &gpio); if (ret == 0) { ret = pm->pwm_get(dev, gpio.line, &divs, &duty); - if (ret == 0) { + if (ret == 0 && divs) { divs = max(divs, duty); if (dev_priv->card_type <= NV_40 || (gpio.log[0] & 1)) duty = divs - duty;