Commit 1ac17586 authored by Frank Rowand's avatar Frank Rowand Committed by Rob Herring

of: overlay: add entry to of_overlay_action_name[]

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: 067c0987 ("of: overlay: rework overlay apply and remove kfree()s")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220502181742.1402826-2-frowand.list@gmail.com
parent b20eee62
...@@ -152,13 +152,6 @@ int of_overlay_notifier_unregister(struct notifier_block *nb) ...@@ -152,13 +152,6 @@ int of_overlay_notifier_unregister(struct notifier_block *nb)
} }
EXPORT_SYMBOL_GPL(of_overlay_notifier_unregister); 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, static int overlay_notify(struct overlay_changeset *ovcs,
enum of_overlay_notify_action action) enum of_overlay_notify_action action)
{ {
...@@ -178,7 +171,7 @@ static int overlay_notify(struct overlay_changeset *ovcs, ...@@ -178,7 +171,7 @@ static int overlay_notify(struct overlay_changeset *ovcs,
if (notifier_to_errno(ret)) { if (notifier_to_errno(ret)) {
ret = notifier_to_errno(ret); ret = notifier_to_errno(ret);
pr_err("overlay changeset %s notifier error %d, target: %pOF\n", 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; return ret;
} }
} }
...@@ -925,10 +918,8 @@ static int of_overlay_apply(struct overlay_changeset *ovcs) ...@@ -925,10 +918,8 @@ static int of_overlay_apply(struct overlay_changeset *ovcs)
goto out; goto out;
ret = overlay_notify(ovcs, OF_OVERLAY_PRE_APPLY); ret = overlay_notify(ovcs, OF_OVERLAY_PRE_APPLY);
if (ret) { if (ret)
pr_err("overlay changeset pre-apply notify error %d\n", ret);
goto out; goto out;
}
ret = build_changeset(ovcs); ret = build_changeset(ovcs);
if (ret) if (ret)
...@@ -951,12 +942,9 @@ static int of_overlay_apply(struct overlay_changeset *ovcs) ...@@ -951,12 +942,9 @@ static int of_overlay_apply(struct overlay_changeset *ovcs)
/* notify failure is not fatal, continue */ /* notify failure is not fatal, continue */
ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_APPLY); ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_APPLY);
if (ret_tmp) { if (ret_tmp)
pr_err("overlay changeset post-apply notify error %d\n",
ret_tmp);
if (!ret) if (!ret)
ret = ret_tmp; ret = ret_tmp;
}
out: out:
pr_debug("%s() err=%d\n", __func__, ret); pr_debug("%s() err=%d\n", __func__, ret);
...@@ -1192,10 +1180,8 @@ int of_overlay_remove(int *ovcs_id) ...@@ -1192,10 +1180,8 @@ int of_overlay_remove(int *ovcs_id)
} }
ret = overlay_notify(ovcs, OF_OVERLAY_PRE_REMOVE); ret = overlay_notify(ovcs, OF_OVERLAY_PRE_REMOVE);
if (ret) { if (ret)
pr_err("overlay changeset pre-remove notify error %d\n", ret);
goto err_unlock; goto err_unlock;
}
ret_apply = 0; ret_apply = 0;
ret = __of_changeset_revert_entries(&ovcs->cset, &ret_apply); ret = __of_changeset_revert_entries(&ovcs->cset, &ret_apply);
...@@ -1218,12 +1204,9 @@ int of_overlay_remove(int *ovcs_id) ...@@ -1218,12 +1204,9 @@ int of_overlay_remove(int *ovcs_id)
* OF_OVERLAY_POST_REMOVE returns an error. * OF_OVERLAY_POST_REMOVE returns an error.
*/ */
ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_REMOVE); ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_REMOVE);
if (ret_tmp) { if (ret_tmp)
pr_err("overlay changeset post-remove notify error %d\n",
ret_tmp);
if (!ret) if (!ret)
ret = ret_tmp; ret = ret_tmp;
}
free_overlay_changeset(ovcs); free_overlay_changeset(ovcs);
......
...@@ -1550,6 +1550,19 @@ enum of_overlay_notify_action { ...@@ -1550,6 +1550,19 @@ enum of_overlay_notify_action {
OF_OVERLAY_POST_REMOVE, 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 of_overlay_notify_data {
struct device_node *overlay; struct device_node *overlay;
struct device_node *target; struct device_node *target;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment