[Nouveau] linux-4.13/drivers/gpu/drm/nouveau/nvkm/subdev/therm/fan.c:86: possible faulty logic ?

David Binderman dcb314 at hotmail.com
Mon Sep 4 10:00:27 UTC 2017

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.


David Binderman

More information about the Nouveau mailing list