From: Greg Kroah-Hartman Date: Mon, 19 Jun 2023 07:06:19 +0000 (+0200) Subject: 5.15-stable patches X-Git-Tag: v4.14.319~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=538fe7fe1d84a83f43faf2b0bbc1d96b0152d36b;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: of-overlay-add-entry-to-of_overlay_action_name.patch --- diff --git a/queue-5.15/of-overlay-add-entry-to-of_overlay_action_name.patch b/queue-5.15/of-overlay-add-entry-to-of_overlay_action_name.patch new file mode 100644 index 00000000000..4458ee4b577 --- /dev/null +++ b/queue-5.15/of-overlay-add-entry-to-of_overlay_action_name.patch @@ -0,0 +1,132 @@ +From 1ac17586c950a2c129393f8a92901a2b357acf24 Mon Sep 17 00:00:00 2001 +From: Frank Rowand +Date: Mon, 2 May 2022 13:17:40 -0500 +Subject: of: overlay: add entry to of_overlay_action_name[] + +From: Frank Rowand + +commit 1ac17586c950a2c129393f8a92901a2b357acf24 upstream. + +The values of enum of_overlay_notify_action are used to index into +array of_overlay_action_name. Add an entry to of_overlay_action_name +for the value recently added to of_overlay_notify_action. + +Array of_overlay_action_name[] is moved into include/linux/of.h +adjacent to enum of_overlay_notify_action to make the connection +between the two more obvious if either is modified in the future. + +The only use of of_overlay_action_name is for error reporting in +overlay_notify(). All callers of overlay_notify() report the same +error, but with fewer details. Remove the redundant error reports +in the callers. + +Fixes: 067c098766c6 ("of: overlay: rework overlay apply and remove kfree()s") +Reported-by: Dan Carpenter +Signed-off-by: Frank Rowand +Signed-off-by: Rob Herring +Link: https://lore.kernel.org/r/20220502181742.1402826-2-frowand.list@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/of/overlay.c | 27 +++++---------------------- + include/linux/of.h | 13 +++++++++++++ + 2 files changed, 18 insertions(+), 22 deletions(-) + +--- a/drivers/of/overlay.c ++++ b/drivers/of/overlay.c +@@ -152,13 +152,6 @@ int of_overlay_notifier_unregister(struc + } + EXPORT_SYMBOL_GPL(of_overlay_notifier_unregister); + +-static char *of_overlay_action_name[] = { +- "pre-apply", +- "post-apply", +- "pre-remove", +- "post-remove", +-}; +- + static int overlay_notify(struct overlay_changeset *ovcs, + enum of_overlay_notify_action action) + { +@@ -178,7 +171,7 @@ static int overlay_notify(struct overlay + if (notifier_to_errno(ret)) { + ret = notifier_to_errno(ret); + pr_err("overlay changeset %s notifier error %d, target: %pOF\n", +- of_overlay_action_name[action], ret, nd.target); ++ of_overlay_action_name(action), ret, nd.target); + return ret; + } + } +@@ -926,10 +919,8 @@ static int of_overlay_apply(struct overl + goto out; + + ret = overlay_notify(ovcs, OF_OVERLAY_PRE_APPLY); +- if (ret) { +- pr_err("overlay changeset pre-apply notify error %d\n", ret); ++ if (ret) + goto out; +- } + + ret = build_changeset(ovcs); + if (ret) +@@ -952,12 +943,9 @@ static int of_overlay_apply(struct overl + /* notify failure is not fatal, continue */ + + ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_APPLY); +- if (ret_tmp) { +- pr_err("overlay changeset post-apply notify error %d\n", +- ret_tmp); ++ if (ret_tmp) + if (!ret) + ret = ret_tmp; +- } + + out: + pr_debug("%s() err=%d\n", __func__, ret); +@@ -1193,10 +1181,8 @@ int of_overlay_remove(int *ovcs_id) + } + + ret = overlay_notify(ovcs, OF_OVERLAY_PRE_REMOVE); +- if (ret) { +- pr_err("overlay changeset pre-remove notify error %d\n", ret); ++ if (ret) + goto err_unlock; +- } + + ret_apply = 0; + ret = __of_changeset_revert_entries(&ovcs->cset, &ret_apply); +@@ -1219,12 +1205,9 @@ int of_overlay_remove(int *ovcs_id) + * OF_OVERLAY_POST_REMOVE returns an error. + */ + ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_REMOVE); +- if (ret_tmp) { +- pr_err("overlay changeset post-remove notify error %d\n", +- ret_tmp); ++ if (ret_tmp) + if (!ret) + ret = ret_tmp; +- } + + free_overlay_changeset(ovcs); + +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -1493,6 +1493,19 @@ enum of_overlay_notify_action { + OF_OVERLAY_POST_REMOVE, + }; + ++static inline char *of_overlay_action_name(enum of_overlay_notify_action action) ++{ ++ static char *of_overlay_action_name[] = { ++ "init", ++ "pre-apply", ++ "post-apply", ++ "pre-remove", ++ "post-remove", ++ }; ++ ++ return of_overlay_action_name[action]; ++} ++ + struct of_overlay_notify_data { + struct device_node *overlay; + struct device_node *target; diff --git a/queue-5.15/series b/queue-5.15/series index 6ea5b3f1c4f..b8d08e3cfce 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -103,3 +103,4 @@ neighbour-remove-unused-inline-function-neigh_key_eq16.patch net-remove-unused-inline-function-dst_hold_and_use.patch net-remove-decnet-leftovers-from-flow.h.patch neighbour-delete-neigh_lookup_nodev-as-not-used.patch +of-overlay-add-entry-to-of_overlay_action_name.patch