• Guenter Roeck's avatar
    power/reset: at91-poweroff: Fix error handling and other compiler warnings · a538cf04
    Guenter Roeck authored
    at91_poweroff_get_wakeup_mode can return a negative error code and should
    therefore not return an enum type. Similar, its result should not be
    assigned to an enum type. Otherwise, the returned value is never negative,
    resulting in a compiler warning and a missed error condition, which in turn
    results in writing bad values into a chip register.
    
    Also fix other compiler warnings which can be easily avoided.
    
    drivers/power/reset/at91-poweroff.c:74:24:
    	warning: type qualifiers ignored on function return type
    drivers/power/reset/at91-poweroff.c:74:24:
    	warning: no previous prototype for 'at91_poweroff_get_wakeup_mode'
    drivers/power/reset/at91-poweroff.c:83:16:
    	warning: comparison between signed and unsigned integer expressions
    drivers/power/reset/at91-poweroff.c:97:2:
    	warning: comparison of unsigned expression < 0 is always false
    
    Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
    Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
    Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    Acked-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
    Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
    a538cf04
at91-poweroff.c 4.28 KB