Skip to contentSkip to conversation

of/unittest: Delete an error message for a failed memory allocation in three functions

PATCH New SF Markus Elfring 1 participant 1 message May 10, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 of/unittest: Delete an error message for a failed memory allocation in three functions

From: Markus Elfring <[email protected]>
Date: Wed, 10 May 2017 22:20:52 +0200

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

---
 drivers/of/unittest.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/of/unittest.c +4 -12
index 987a1530282a..9554f83a0260 100644
@@ -914,12 +914,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__);
@@ -1593,12 +1590,9 @@ static int unittest_i2c_bus_probe(struct platform_device *pdev)
 	}
 
 	dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name);
-
 	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;
@@ -2062,10 +2056,8 @@ static int __init overlay_data_add(int onum)
 	 * will create pointers to the passed in FDT in the EDT.
 	 */
 	info->data = kmemdup(info->dtb_begin, size, GFP_KERNEL);
-	if (!info->data) {
-		pr_err("unable to allocate memory for data, %d\n", onum);
+	if (!info->data)
 		return 0;
-	}
 
 	of_fdt_unflatten_tree(info->data, NULL, &info->np_overlay);
 	if (!info->np_overlay) {
Signature · 1 line
2.12.3