tegra20: display: fix checking of return value
Subsystems (2)
PATCH 1/1 tegra20: display: fix checking of return value
The calling code seems a bit in doubt about the return value of fdtdec_lookup_phandle. Since it returns a negative value on error (and fdt_node_offset_by_phandle as well), check for that.
cc Wei Ni <[email protected]>
Signed-off-by Jeroen Hofstee <[email protected]>
---
arch/arm/cpu/armv7/tegra20/display.c:331:26: warning: comparison of constant 0 with boolean expression is always false [-Wtautological-constant-out-of-range-compare]
if (!config->panel_node < 0) {
~~~~~~~~~~~~~~~~~~~ ^ ~NOT tested on hw.
--- arch/arm/cpu/armv7/tegra20/display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv7/tegra20/display.c +1 -1
@@ -328,7 +328,7 @@ static int tegra_display_decode_config(const void *blob, rgb =fdt_subnode_offset (blob, node,"rgb" ); config->panel_node =fdtdec_lookup_phandle (blob, rgb,"nvidia,panel" ); -if (!config->panel_node <0 ) { +if (config->panel_node <0 ) {debug ("%s: Cannot find panel information\n" , __func__);return -1 ; }
Signature · 1 line
1.8.3.2
PATCH 1/1 tegra20: display: fix checking of return value
Quoted 4 lines · Jeroen Hofstee
The calling code seems a bit in doubt about the return value of
fdtdec_lookup_phandle. Since it returns a negative value on error (andfdt_node_offset_by_phandleas well), check for that.
Tested-by Stephen Warren <[email protected]>
(On Seaboard/Springbank; booted via tegrarcm and the LCD still works)