Skip to content

Commit 8107b37

Browse files
committed
utils/hooks: Don't fail early if fb0 missing
30-dtb-updates would exit early if the 'fb0' file was missing, however the set_stdout() step does not depend on this. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
1 parent d0602ed commit 8107b37

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

utils/hooks/30-dtb-updates.c

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -576,20 +576,10 @@ static int write_devicetree(struct offb_ctx *ctx)
576576
return rc;
577577
}
578578

579-
580-
int main(void)
579+
static int set_offb(struct offb_ctx *ctx)
581580
{
582-
struct offb_ctx *ctx;
583581
int rc;
584582

585-
ctx = talloc_zero(NULL, struct offb_ctx);
586-
587-
ctx->dtb_name = getenv("boot_dtb");
588-
if (!ctx->dtb_name) {
589-
talloc_free(ctx);
590-
return EXIT_SUCCESS;
591-
}
592-
593583
rc = load_dtb(ctx);
594584
if (rc)
595585
goto out;
@@ -605,14 +595,39 @@ int main(void)
605595
rc = populate_devicetree(ctx);
606596
if (rc)
607597
goto out;
598+
out:
599+
return rc;
600+
}
608601

609-
rc = set_stdout(ctx);
610-
if (rc)
611-
goto out;
612602

613-
rc = write_devicetree(ctx);
603+
int main(void)
604+
{
605+
struct offb_ctx *ctx;
606+
int rc;
607+
608+
ctx = talloc_zero(NULL, struct offb_ctx);
609+
610+
ctx->dtb_name = getenv("boot_dtb");
611+
if (!ctx->dtb_name) {
612+
talloc_free(ctx);
613+
return EXIT_SUCCESS;
614+
}
615+
616+
if (set_offb(ctx)) {
617+
warn("Failed offb setup step");
618+
rc = -1;
619+
}
620+
621+
if (set_stdout(ctx)) {
622+
warn("Failed stdout setup step\n");
623+
rc = -1;
624+
}
625+
626+
if (write_devicetree(ctx)) {
627+
warn("Failed to write back device tree\n");
628+
rc = -1;
629+
}
614630

615-
out:
616631
talloc_free(ctx);
617632
return rc ? EXIT_FAILURE : EXIT_SUCCESS;
618633
}

0 commit comments

Comments
 (0)