clk: at91: Fix testing of unsigned variable to be negative
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Wed, 23 Jul 2025 14:13:48 +0000 (15:13 +0100)
committerEugen Hristev <eugen.hristev@linaro.org>
Wed, 13 Aug 2025 09:59:36 +0000 (12:59 +0300)
commit29ea990a1c4a2455f432d5e71b217e93b406fc12
tree009eedbb5871a0d4ad71bf9030ffc5e698217090
parent709b5be0a48d4e5bb95ef0b107c56045a8fe67c6
clk: at91: Fix testing of unsigned variable to be negative

The variable 'index' is declared as unsigned but used to receive the
return value of a function returning 'int'. This value is then tested
for being less than zero to detect an error condition but as index is
unsigned this can never be true. Change the variable 'index' to be an
int so that the error condition can be detected.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/clk/at91/clk-main.c
drivers/clk/at91/clk-master.c