Skip to content

Commit 6de67de

Browse files
geerturobherring
authored andcommitted
of: overlay: Remove else after goto
If an "if" branch is terminated by a "goto", there's no need to have an "else" statement and an indented block of code. Remove the "else" statement to simplify the code flow for the casual reviewer. Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Rob Herring <[email protected]>
1 parent e9d92e4 commit 6de67de

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

drivers/of/overlay.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,9 @@ static int init_overlay_changeset(struct overlay_changeset *ovcs,
580580
of_node_put(fragment->overlay);
581581
ret = -EINVAL;
582582
goto err_free_fragments;
583-
} else {
584-
cnt++;
585583
}
584+
585+
cnt++;
586586
}
587587
}
588588

@@ -736,14 +736,13 @@ int of_overlay_apply(struct device_node *tree, int *ovcs_id)
736736
devicetree_state_flags |= DTSF_APPLY_FAIL;
737737
}
738738
goto err_free_overlay_changeset;
739-
} else {
740-
ret = __of_changeset_apply_notify(&ovcs->cset);
741-
if (ret)
742-
pr_err("overlay changeset entry notify error %d\n",
743-
ret);
744-
/* fall through */
745739
}
746740

741+
ret = __of_changeset_apply_notify(&ovcs->cset);
742+
if (ret)
743+
pr_err("overlay changeset entry notify error %d\n", ret);
744+
/* notify failure is not fatal, continue */
745+
747746
list_add_tail(&ovcs->ovcs_list, &ovcs_list);
748747
*ovcs_id = ovcs->id;
749748

@@ -931,15 +930,13 @@ int of_overlay_remove(int *ovcs_id)
931930
if (ret_apply)
932931
devicetree_state_flags |= DTSF_REVERT_FAIL;
933932
goto out_unlock;
934-
} else {
935-
ret = __of_changeset_revert_notify(&ovcs->cset);
936-
if (ret) {
937-
pr_err("overlay changeset entry notify error %d\n",
938-
ret);
939-
/* fall through - changeset was reverted */
940-
}
941933
}
942934

935+
ret = __of_changeset_revert_notify(&ovcs->cset);
936+
if (ret)
937+
pr_err("overlay changeset entry notify error %d\n", ret);
938+
/* notify failure is not fatal, continue */
939+
943940
*ovcs_id = 0;
944941

945942
ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_REMOVE);

0 commit comments

Comments
 (0)