of_get_flat_dt_subnode_by_name return the offset of the subnode, and we should check if it's valid. But the original code use the unsigned type to check it, which makes the we always get subnode successfully even if returning -FDT_ERR_BADPATH etc. Let's fix it by adding offset variable. Suggested-by: Mark Rutland <mark.rutland@xxxxxxx> Signed-off-by: Shawn Lin <shawn.lin@xxxxxxxxxxxxxx> --- drivers/firmware/efi/efi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 5a2631a..7a5964e 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -647,6 +647,7 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, { struct param_info *info = data; int i; + int offset = node; for (i = 0; i < ARRAY_SIZE(dt_params); i++) { const char *subnode = dt_params[i].subnode; @@ -657,12 +658,12 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, } if (subnode) { - node = of_get_flat_dt_subnode_by_name(node, subnode); - if (node < 0) + offset = of_get_flat_dt_subnode_by_name(node, subnode); + if (offset < 0) return 0; } - return __find_uefi_params(node, info, dt_params[i].params); + return __find_uefi_params(offset, info, dt_params[i].params); } return 0; -- 2.3.7 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html