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

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>

authored by

Geert Uytterhoeven and committed by
Rob Herring
2a656cb5 6f7dc9a3

+4 -9
+4 -9
drivers/of/unittest.c
··· 344 344 } 345 345 346 346 nh = kzalloc(sizeof(*nh), GFP_KERNEL); 347 - if (WARN_ON(!nh)) 347 + if (!nh) 348 348 return; 349 349 350 350 nh->np = np; ··· 1199 1199 1200 1200 /* creating copy */ 1201 1201 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) 1206 1203 return -ENOMEM; 1207 - } 1204 + 1208 1205 of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node); 1209 1206 if (!unittest_data_node) { 1210 1207 pr_warn("%s: No tree to attach; not running tests\n", __func__); ··· 1842 1845 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); 1843 1846 1844 1847 std = devm_kzalloc(dev, sizeof(*std), GFP_KERNEL); 1845 - if (!std) { 1846 - dev_err(dev, "Failed to allocate unittest i2c data\n"); 1848 + if (!std) 1847 1849 return -ENOMEM; 1848 - } 1849 1850 1850 1851 /* link them together */ 1851 1852 std->pdev = pdev;