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 <geert+renesas@glider.be> Signed-off-by: Rob Herring <robh@kernel.org>
This commit is contained in:
parent
6f7dc9a37f
commit
2a656cb5a4
@ -344,7 +344,7 @@ static void __init of_unittest_check_phandles(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nh = kzalloc(sizeof(*nh), GFP_KERNEL);
|
nh = kzalloc(sizeof(*nh), GFP_KERNEL);
|
||||||
if (WARN_ON(!nh))
|
if (!nh)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nh->np = np;
|
nh->np = np;
|
||||||
@ -1199,12 +1199,9 @@ static int __init unittest_data_add(void)
|
|||||||
|
|
||||||
/* creating copy */
|
/* creating copy */
|
||||||
unittest_data = kmemdup(__dtb_testcases_begin, size, GFP_KERNEL);
|
unittest_data = kmemdup(__dtb_testcases_begin, size, GFP_KERNEL);
|
||||||
|
if (!unittest_data)
|
||||||
if (!unittest_data) {
|
|
||||||
pr_warn("%s: Failed to allocate memory for unittest_data; "
|
|
||||||
"not running tests\n", __func__);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node);
|
of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node);
|
||||||
if (!unittest_data_node) {
|
if (!unittest_data_node) {
|
||||||
pr_warn("%s: No tree to attach; not running tests\n", __func__);
|
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)
|
|||||||
dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
|
dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
|
||||||
|
|
||||||
std = devm_kzalloc(dev, sizeof(*std), GFP_KERNEL);
|
std = devm_kzalloc(dev, sizeof(*std), GFP_KERNEL);
|
||||||
if (!std) {
|
if (!std)
|
||||||
dev_err(dev, "Failed to allocate unittest i2c data\n");
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
/* link them together */
|
/* link them together */
|
||||||
std->pdev = pdev;
|
std->pdev = pdev;
|
||||||
|
Loading…
Reference in New Issue
Block a user