karo: fdt: fix error handling for reg-can-xcvr
authorLothar Waßmann <LW@KARO-electronics.de>
Tue, 16 Jun 2020 07:06:53 +0000 (09:06 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 16 Jun 2020 08:18:59 +0000 (10:18 +0200)
board/karo/common/fdt.c

index 7f6ac56..fe3520b 100644 (file)
@@ -418,10 +418,10 @@ void karo_fdt_fixup_flexcan(void *blob, int xcvr_present)
                debug("Disabling CAN XCVR\n");
                ret = fdt_find_and_setprop(blob, "reg-can-xcvr", "status",
                                        xcvr_status, strlen(xcvr_status) + 1, 1);
                debug("Disabling CAN XCVR\n");
                ret = fdt_find_and_setprop(blob, "reg-can-xcvr", "status",
                                        xcvr_status, strlen(xcvr_status) + 1, 1);
-               if (ret == -FDT_ERR_NOTFOUND)
+               if (ret == -FDT_ERR_NOTFOUND || ret == -FDT_ERR_BADPATH)
                        ret = fdt_find_and_setprop(blob, "reg_can_xcvr", "status",
                                                   xcvr_status, strlen(xcvr_status) + 1, 1);
                        ret = fdt_find_and_setprop(blob, "reg_can_xcvr", "status",
                                                   xcvr_status, strlen(xcvr_status) + 1, 1);
-               if (ret != -FDT_ERR_NOTFOUND)
+               if (ret && ret != -FDT_ERR_NOTFOUND && ret != -FDT_ERR_BADPATH)
                        printf("Failed to disable CAN transceiver switch: %s\n",
                                fdt_strerror(ret));
        }
                        printf("Failed to disable CAN transceiver switch: %s\n",
                                fdt_strerror(ret));
        }