David Binderman
2017-Sep-04  10:00 UTC
[Nouveau] linux-4.13/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c:86: possible faulty logic ?
Hello there,
[linux-4.13/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c:93]: (warning)
Opposite inner 'if' condition leads to a dead code block.
Source code is
    if (target != duty) {
        u16 bump_period = fan->bios.bump_period;
        u16 slow_down_period = fan->bios.slow_down_period;
        u64 delay;
        if (duty > target)
            delay = slow_down_period;
        else if (duty == target)
            delay = min(bump_period, slow_down_period) ;
Last if can never be true, so call to min can never execute. Suggest code
rework.
Regards
David Binderman
Reasonably Related Threads
- [PATCH] drm/nouveau/therm: remove redundant duty == target check
- drivers/gpu/drm/nouveau/nvkm/subdev/therm/temp.c: broken emergency poweroff handling
- [PATCH 1/4] pm/fan: drop the fan lock in fan_update() before rescheduling
- 4.16-rc1: UBSAN warning in nouveau/nvkm/subdev/therm/base.c + oops in nvkm_therm_clkgate_fini
- 4.16-rc1: UBSAN warning in nouveau/nvkm/subdev/therm/base.c + oops in nvkm_therm_clkgate_fini
