* [PATCH] of: unittest: Remove error printing on OOM
@ 2019-05-02 12:45 Geert Uytterhoeven
2019-05-02 21:41 ` Rob Herring
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2019-05-02 12:45 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: devicetree, linux-kernel, Geert Uytterhoeven
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>
---
drivers/of/unittest.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 2f8e43876c3da70c..a3d31103962b7dd9 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -344,7 +344,7 @@ static void __init of_unittest_check_phandles(void)
}
nh = kzalloc(sizeof(*nh), GFP_KERNEL);
- if (WARN_ON(!nh))
+ if (!nh)
return;
nh->np = np;
@@ -1199,12 +1199,9 @@ static int __init unittest_data_add(void)
/* creating copy */
unittest_data = kmemdup(__dtb_testcases_begin, size, GFP_KERNEL);
-
- if (!unittest_data) {
- pr_warn("%s: Failed to allocate memory for unittest_data; "
- "not running tests\n", __func__);
+ if (!unittest_data)
return -ENOMEM;
- }
+
of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node);
if (!unittest_data_node) {
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);
std = devm_kzalloc(dev, sizeof(*std), GFP_KERNEL);
- if (!std) {
- dev_err(dev, "Failed to allocate unittest i2c data\n");
+ if (!std)
return -ENOMEM;
- }
/* link them together */
std->pdev = pdev;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] of: unittest: Remove error printing on OOM
2019-05-02 12:45 [PATCH] of: unittest: Remove error printing on OOM Geert Uytterhoeven
@ 2019-05-02 21:41 ` Rob Herring
0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2019-05-02 21:41 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Frank Rowand, devicetree, linux-kernel
On Thu, May 2, 2019 at 7:45 AM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> 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>
> ---
> drivers/of/unittest.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
Applied both patches.
Rob
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-02 21:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-02 12:45 [PATCH] of: unittest: Remove error printing on OOM Geert Uytterhoeven
2019-05-02 21:41 ` Rob Herring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).