Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 067c098766c6 ("of: overlay: rework overlay apply and remove kfree()s")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220502181742.1402826-2-frowand.list@gmail.com

authored by

Frank Rowand and committed by
Rob Herring
1ac17586 b20eee62

+18 -22
+5 -22
drivers/of/overlay.c
··· 152 152 } 153 153 EXPORT_SYMBOL_GPL(of_overlay_notifier_unregister); 154 154 155 - static char *of_overlay_action_name[] = { 156 - "pre-apply", 157 - "post-apply", 158 - "pre-remove", 159 - "post-remove", 160 - }; 161 - 162 155 static int overlay_notify(struct overlay_changeset *ovcs, 163 156 enum of_overlay_notify_action action) 164 157 { ··· 171 178 if (notifier_to_errno(ret)) { 172 179 ret = notifier_to_errno(ret); 173 180 pr_err("overlay changeset %s notifier error %d, target: %pOF\n", 174 - of_overlay_action_name[action], ret, nd.target); 181 + of_overlay_action_name(action), ret, nd.target); 175 182 return ret; 176 183 } 177 184 } ··· 918 925 goto out; 919 926 920 927 ret = overlay_notify(ovcs, OF_OVERLAY_PRE_APPLY); 921 - if (ret) { 922 - pr_err("overlay changeset pre-apply notify error %d\n", ret); 928 + if (ret) 923 929 goto out; 924 - } 925 930 926 931 ret = build_changeset(ovcs); 927 932 if (ret) ··· 942 951 /* notify failure is not fatal, continue */ 943 952 944 953 ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_APPLY); 945 - if (ret_tmp) { 946 - pr_err("overlay changeset post-apply notify error %d\n", 947 - ret_tmp); 954 + if (ret_tmp) 948 955 if (!ret) 949 956 ret = ret_tmp; 950 - } 951 957 952 958 out: 953 959 pr_debug("%s() err=%d\n", __func__, ret); ··· 1180 1192 } 1181 1193 1182 1194 ret = overlay_notify(ovcs, OF_OVERLAY_PRE_REMOVE); 1183 - if (ret) { 1184 - pr_err("overlay changeset pre-remove notify error %d\n", ret); 1195 + if (ret) 1185 1196 goto err_unlock; 1186 - } 1187 1197 1188 1198 ret_apply = 0; 1189 1199 ret = __of_changeset_revert_entries(&ovcs->cset, &ret_apply); ··· 1204 1218 * OF_OVERLAY_POST_REMOVE returns an error. 1205 1219 */ 1206 1220 ret_tmp = overlay_notify(ovcs, OF_OVERLAY_POST_REMOVE); 1207 - if (ret_tmp) { 1208 - pr_err("overlay changeset post-remove notify error %d\n", 1209 - ret_tmp); 1221 + if (ret_tmp) 1210 1222 if (!ret) 1211 1223 ret = ret_tmp; 1212 - } 1213 1224 1214 1225 free_overlay_changeset(ovcs); 1215 1226
+13
include/linux/of.h
··· 1550 1550 OF_OVERLAY_POST_REMOVE, 1551 1551 }; 1552 1552 1553 + static inline char *of_overlay_action_name(enum of_overlay_notify_action action) 1554 + { 1555 + static char *of_overlay_action_name[] = { 1556 + "init", 1557 + "pre-apply", 1558 + "post-apply", 1559 + "pre-remove", 1560 + "post-remove", 1561 + }; 1562 + 1563 + return of_overlay_action_name[action]; 1564 + } 1565 + 1553 1566 struct of_overlay_notify_data { 1554 1567 struct device_node *overlay; 1555 1568 struct device_node *target;