Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1997826imu; Wed, 21 Nov 2018 05:19:30 -0800 (PST) X-Google-Smtp-Source: AFSGD/W8cCHNhz56y3HTbsETPWL2ZmBnSDydVcWsjpMKI2uyp2XGaoLq3L/uK7uM393QDNUkkiJb X-Received: by 2002:a63:c00b:: with SMTP id h11mr6069285pgg.429.1542806370867; Wed, 21 Nov 2018 05:19:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542806370; cv=none; d=google.com; s=arc-20160816; b=0cmQc7B0w1YzIG6CaB6nMGWfm1WYYQbXC8IUmlzBsCsAInXuvk7Mlt/qnLlsJ0MenO 3icRRz263uyyxhqArSNvE5Oq2VN9spUIV3ukxglIvNoobciu5FL00ZRx+S0Ru5OLn4wB UYBVuuFZM4NsagQDXT/oYzcJJu5tFzcTZZQYgaH0SuHWwNmPkR+cimVwSABgVnv1UiHo TpwTd5y6csNUT2sXDjEjYbyYQb6/eNUE9SlK5Lf6iSJ1wJAOCRnO9GNQq441iwbVU9/Y IgvT2h0bBqAnVc8uxMXInrnHW+e+uW78nCAAMs343fmEr0Bt5fch++sprQcJydzyDA66 b5tw== 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=+4Wx7CZNQ7HnTyUJ/ftY1ndpunecj6YBvBEzmaEC+0Y=; b=PZq81FQAM3LlWkT6bhYRJz/Qz7IiV4mJ7Eyojv61HgYQAuYeS6HWKPa69f2F93y6IC /4vs9y1R6SyeTpt5FoCPCv092tDbNKfTOPrPnmSBLZHTK3USEFmwpGHOcekRe/iTEsiO CpTAIFZ1MB3dXBL7XolBIHmmYd/n27nxQ5IbnvA+p6/BREs26filSXJ/zGEtlPOvuptx oEDq4kUpA11hheEgbVvPv7Jt6QRPXs5cTNi+zT+c6SImJJjScciCm2gzwsoG6kIK159a kOkMNTtdlQQA+huBXUDHzZqGrcF170y9/vNwtdDUr3SICXivTybPlcsjmaWuu+gpUd7k kbFw== 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 e129si45268586pgc.333.2018.11.21.05.19.13; Wed, 21 Nov 2018 05:19:30 -0800 (PST) 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 S1730228AbeKUXIS (ORCPT + 99 others); Wed, 21 Nov 2018 18:08:18 -0500 Received: from www.osadl.org ([62.245.132.105]:36442 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729233AbeKUXIS (ORCPT ); Wed, 21 Nov 2018 18:08:18 -0500 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id wALCVUk8029987; Wed, 21 Nov 2018 13:31:30 +0100 From: Nicholas Mc Guire To: Michael Turquette Cc: Stephen Boyd , Michal Simek , Rob Herring , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH V2] clk: zynq: do not allow kmalloc failure Date: Wed, 21 Nov 2018 13:28:30 +0100 Message-Id: <1542803310-32673-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kmalloc here is small (< 16 bytes) and occurs during initialization during system startup here (can not be built as module) thus if this kmalloc failed it is an indication of something more serious going on and it is fine to hang the system here rather than cause some harder to understand error by dereferencing NULL. Explicitly checking would not make that much sense here as the only possible reaction would be would BUG() here anyway. Signed-off-by: Nicholas Mc Guire Fixes: 0ee52b157b8e ("clk: zynq: Add clock controller driver") Acked-by: Michal Simek --- V2: dropped leading spaces from commit message and moved the compile/tool info out of git history on request of Michal Simek - thanks ! Problem located with experimental coccinelle script Patch was compile tested with: multi_v7_defconfig (implies CONFIG_ARCH_ZYNQ=y) Patch is against 4.20-rc3 (localversion-next is next-20181121) drivers/clk/zynq/clkc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c index d7b53ac..014d4a4 100644 --- a/drivers/clk/zynq/clkc.c +++ b/drivers/clk/zynq/clkc.c @@ -440,7 +440,7 @@ static void __init zynq_clk_setup(struct device_node *np) SLCR_GEM1_CLK_CTRL, 0, 0, &gem1clk_lock); tmp = strlen("mio_clk_00x"); - clk_name = kmalloc(tmp, GFP_KERNEL); + clk_name = kmalloc(tmp, GFP_KERNEL | __GFP_NOFAIL); for (i = 0; i < NUM_MIO_PINS; i++) { int idx; -- 2.1.4