From patchwork Wed Feb 22 21:58:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li zeming X-Patchwork-Id: 13147408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 89580C636D7 for ; Tue, 21 Feb 2023 05:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=b1H7oCifRKtBXIVQdPNfFbRrBYj28MkRfrhNpPDdc50=; b=euMcDn0L7NprcP 60N3Je/kW8lYc89QNvQ/v50ci6ws7BsUHkua+BYLb+940jrlI3RVHXhSvzHQ01apro+o31Zcrw9l4 ynrU6eEu/O6CdDGIpMfquc0GIbufI8Tthd4ELV+AXjBUQPf+F85ryyg8FySUKDiIhdKB6ORj+xEyI 3UZavsXjSrVs4Vs1jQc6F48taO+HShsxCDmMQmKSqeYRPVjiUGjwej2vLNHZs0wCC2rpJYBqwCbZw LVGn/FI5nKfMKkbLFgKk+YLOvHe3sbjUi1PNnn5/E6uzBNmYmW43ogyVyFzidxfWPheydJUjzdKhZ rBJWtwRNxfirVjbHkR7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pULGx-006gVf-Cn; Tue, 21 Feb 2023 05:33:03 +0000 Received: from [42.101.60.237] (helo=mail.nfschina.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pULGu-006gVD-J0 for linux-arm-kernel@lists.infradead.org; Tue, 21 Feb 2023 05:33:01 +0000 Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id CD4D81A009F1; Tue, 21 Feb 2023 13:27:54 +0800 (CST) X-Virus-Scanned: amavisd-new at nfschina.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (localhost.localdomain [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wRel6M8OWtfb; Tue, 21 Feb 2023 13:27:54 +0800 (CST) Received: from localhost.localdomain (unknown [219.141.250.2]) (Authenticated sender: zeming@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id EB0271A009BB; Tue, 21 Feb 2023 13:27:53 +0800 (CST) From: Li zeming To: mturquette@baylibre.com, sboyd@kernel.org, michal.simek@xilinx.com Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Li zeming Subject: [PATCH] zynq: clkc: Add kmalloc allocation flag Date: Thu, 23 Feb 2023 05:58:34 +0800 Message-Id: <20230222215834.3507-1-zeming@nfschina.com> X-Mailer: git-send-email 2.18.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230220_213300_821439_D903D776 X-CRM114-Status: UNSURE ( 9.63 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The kmalloc could crash if allocation fails. Add the __GFP_NOFAIL flag to ensure that allocation succeeds every time. Signed-off-by: Li zeming --- 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 7bdeaff2bfd6..7621c2f00468 100644 --- a/drivers/clk/zynq/clkc.c +++ b/drivers/clk/zynq/clkc.c @@ -427,7 +427,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;