src/sys/arm64/rockchip/rk_pinctrl.c:354]: (style) Unsigned variable 'bias' can't be negative so it is unnecessary to test it. Source code is bias = rk_pinctrl_parse_bias(pin_conf); if (bias >= 0) { but bias is unsigned and the return type of the function is int. Suggest sanity check return value from function *before* writing it into an unsigned variable.
Created attachment 248859 [details] Make bias variable signed
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=97ab935d566c85458bc7cab99c402f026d704eff commit 97ab935d566c85458bc7cab99c402f026d704eff Author: John F. Carr <jfc@mit.edu> AuthorDate: 2024-06-14 16:37:06 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2024-06-14 16:42:27 +0000 rk_pinctrl: fix error check The parse_bias method returns a signed int, with a value of -1 when the device tree reports nothing of the bias configuration. Convert the local 'bias' from unsigned to signed to properly check this condition. PR: 229721 Reviewed by: mhorne MFC after: 3 days sys/arm64/rockchip/rk_pinctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=53a64a0938241869b7dc657c5bf30e3bde1879c2 commit 53a64a0938241869b7dc657c5bf30e3bde1879c2 Author: John F. Carr <jfc@mit.edu> AuthorDate: 2024-06-14 16:37:06 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2024-06-27 17:56:23 +0000 rk_pinctrl: fix error check The parse_bias method returns a signed int, with a value of -1 when the device tree reports nothing of the bias configuration. Convert the local 'bias' from unsigned to signed to properly check this condition. PR: 229721 Reviewed by: mhorne MFC after: 3 days (cherry picked from commit 97ab935d566c85458bc7cab99c402f026d704eff) sys/arm64/rockchip/rk_pinctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)