Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7179755yba; Thu, 2 May 2019 05:46:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZjdjMmfWOOhQEFLy06YfvgtE2a8e0AnVTIh78/YhM5OitQ7PT7pmYu1Ei9FXMBISJcjVu X-Received: by 2002:a25:41d0:: with SMTP id o199mr2852560yba.415.1556801207365; Thu, 02 May 2019 05:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556801207; cv=none; d=google.com; s=arc-20160816; b=X4k+sOMLJi7kx72hIFB8JIQ2M47ho/Y+blahoiXdwUgbd3ojt3OrCd3F8BDNZWKPeB j0SRpUbfavOgCmCrUjgfeFyk+KV9/Dxrqh5uwXhMoi+yaQTj7eQqTk6Zw+2je9aPN02t nA2GoXFtXmuNrcsz/AD+n41a/+P4Y+pSVAaB4QKtsDg4gtYTu9bJCLh8hB8lv7DHQhVJ a8VdPeAvlWFpRFhVsIFZP44q851oePbHCSAyiNED4/IkV/62J/OhawfH0XmDjfVMXgOh xQs6wfzTRSY6zEuFwV6ZJ1I8UXvxVVkMrbPyInSOFtgJi6nWfK14v02tVb8WGpSxHvbq MCOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=stH4qLY3l6Hg2LwK9A7cw+G9iLXgoP19LEJi7DfJc9g=; b=UlLvN+vLzwq9Yha5mcjv63OIVDehPCE6Njbg7f5Dx2xXd9okPw5QAgW4DErcO2dPOt ZwCkg3zARBJp0BqP44MjUClrPeTZg/9Ns++nUJqZu6RktBgwagmJfHDzByhEU1Ky+hGc Fis2lup9W8KykQFc/heIhslwpHJMM13v3Phn0hHY3hhYxQYEgtVxtGSodzvtqfadKcRD bdPfpL3N29k8+RSdCLM2Yl0ieXurwbc1jTR3dKrzxxMBMmxhRGZVulEvgDEriBXKv7Ue uQUEKyLKki5JSIbPOinChXiDH9ozu26rvK5nZhKe4ax7LfzR7aG96+PK7ScO0kiHSki6 yayQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w1si18578174ywi.30.2019.05.02.05.46.34; Thu, 02 May 2019 05:46:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726466AbfEBMpi (ORCPT + 99 others); Thu, 2 May 2019 08:45:38 -0400 Received: from albert.telenet-ops.be ([195.130.137.90]:54758 "EHLO albert.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726329AbfEBMpi (ORCPT ); Thu, 2 May 2019 08:45:38 -0400 Received: from ramsan ([84.194.111.163]) by albert.telenet-ops.be with bizsmtp id 7Qld200053XaVaC06Qldtr; Thu, 02 May 2019 14:45:37 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1hMB5k-0007h4-WA; Thu, 02 May 2019 14:45:37 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1hMB5k-0001eE-Uc; Thu, 02 May 2019 14:45:36 +0200 From: Geert Uytterhoeven To: Rob Herring , Frank Rowand Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] of: unittest: Remove error printing on OOM Date: Thu, 2 May 2019 14:45:35 +0200 Message-Id: <20190502124535.6292-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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