Skip to content

Commit 2a656cb

Browse files
geerturobherring
authored andcommitted
of: unittest: Remove error printing on OOM
There is no need to print a backtrace or other error message if kzalloc(), kmemdup(), or devm_kzalloc() fails, as the memory allocation core already takes care of that. Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Rob Herring <[email protected]>
1 parent 6f7dc9a commit 2a656cb

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

drivers/of/unittest.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ static void __init of_unittest_check_phandles(void)
344344
}
345345

346346
nh = kzalloc(sizeof(*nh), GFP_KERNEL);
347-
if (WARN_ON(!nh))
347+
if (!nh)
348348
return;
349349

350350
nh->np = np;
@@ -1199,12 +1199,9 @@ static int __init unittest_data_add(void)
11991199

12001200
/* creating copy */
12011201
unittest_data = kmemdup(__dtb_testcases_begin, size, GFP_KERNEL);
1202-
1203-
if (!unittest_data) {
1204-
pr_warn("%s: Failed to allocate memory for unittest_data; "
1205-
"not running tests\n", __func__);
1202+
if (!unittest_data)
12061203
return -ENOMEM;
1207-
}
1204+
12081205
of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node);
12091206
if (!unittest_data_node) {
12101207
pr_warn("%s: No tree to attach; not running tests\n", __func__);
@@ -1845,10 +1842,8 @@ static int unittest_i2c_bus_probe(struct platform_device *pdev)
18451842
dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
18461843

18471844
std = devm_kzalloc(dev, sizeof(*std), GFP_KERNEL);
1848-
if (!std) {
1849-
dev_err(dev, "Failed to allocate unittest i2c data\n");
1845+
if (!std)
18501846
return -ENOMEM;
1851-
}
18521847

18531848
/* link them together */
18541849
std->pdev = pdev;

0 commit comments

Comments
 (0)