Message ID | 20230727053156.13587-2-claudiu.beznea@tuxon.dev (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 4E7CBEB64DD for <linux-arm-kernel@archiver.kernel.org>; Thu, 27 Jul 2023 05:33:09 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=DYhUPzdgmXK1mPmU54KiY7sNYxsxa3YiGZXsdZVGbxo=; b=wbrFIlPWjS5ij6 73QEbpB88nXxHd6m91pqgMxGrAej1n35sXKmg9rjxxBEowKn75fE6vUPj1lZtuhC3ebIX6lGHkr5l wGLOU21HDYGZ2Z8GSwI6InUSTiIWi0mET1gxVzIGgoJa0ReWDHlAjJHOe5mIq7QG/UnAcbAgEVZes TjPeKeO8iaOkpYmdBMA4CcS2NWpkl4qQm3tlYHasWt0grxUfILWItbhSKxGInh3iJJag+uWtIt40N SsPi3V20BM6lDSpX+0W02jmqZjMfD2Jk/tFDk/RgtXdouF5Ju5h+ITOuxr6MK+/m0ln1scAPCZykO pLIhYNVckUxGjVbAyT/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qOtcE-00CBdI-30; Thu, 27 Jul 2023 05:32:46 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qOtc7-00CBbu-2q for linux-arm-kernel@lists.infradead.org; Thu, 27 Jul 2023 05:32:41 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1bb84194bf3so3419595ad.3 for <linux-arm-kernel@lists.infradead.org>; Wed, 26 Jul 2023 22:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1690435957; x=1691040757; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Uyw3PNfZIGdqDhQAwksMXr4rBdSDRWmBdpkW/XA90lY=; b=drVvjIcn6IwB7Xn0zmy1NP5nq8SSNIQeAYnATBZ8fVrsX3Re7hS8xvzwCPrOOmVYDT yvIrdOKnD205U8KOaVniDdHmXe61quc45RJ0Xm894JcBaaGRr4BKabCckcXl5URiQWH0 OGbAX7YKljP3iTfl/3QanAGlykvZsQi5Y0AYQrXpWJViHwMX+u6xE7IXKi/2Z0Th2JQG IBiQCMQdJMO/DQaTOPzXZ1Tq9oT1VWrQk0dSWDwwnMayGY9EoNDPEtcPQjFfsnoaccIx 5iW8qx8pC5Q4xnmtaK6y7SmD1mHgGXItb87R/AB/rTYXh3OuZAYkoO7kg72q+pYebyVk KTxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690435957; x=1691040757; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uyw3PNfZIGdqDhQAwksMXr4rBdSDRWmBdpkW/XA90lY=; b=XPzf1GtxpH/PYxtLhugzjjnHrtQh65V9TJ7cVsFJSuEpjBz+K8r0KzoPrkwdUYAlTK 7hmAVQGNYT2JmYlY2jmJTl5Jfk2DGkIsSGL4YZTeKJhHFJ7JZhXPt+HUM0IJMx3yLNRN KNTFe/xRnyKbdoUgr32FX378JB1aq3wyBzuxCeY5AnGcBX4w55810H7MX+c0bjYJu5Tk wBnaRAGeJmtognnC9yVqZUuUguFfoEaBDCR6SjTW8y2iieJZeVmUYE4013LQTb6syL7t 7QvS1z0t/K/+sv1PuONtNL/lOx6cFhV6nBjrREtv8xJcZjp6r+F39K5Xyq/TMMyPRvrL P7RA== X-Gm-Message-State: ABy/qLbJB6rg0PQZXG1aqngiCWZ9vE55rbYRVkZWlQ5xw//5PSGXOkDP 9bCG+hgkVXL0arPBwpvbTJubgQ== X-Google-Smtp-Source: APBJJlFaiXidP9D8t/SlKdr/7PjGHe8B2LxzQ0uXp+qc5AmYStgN8YypNaZm+7pCUSKDHPRfKQtsJw== X-Received: by 2002:a17:903:2305:b0:1b8:1687:b53 with SMTP id d5-20020a170903230500b001b816870b53mr4574340plh.26.1690435956889; Wed, 26 Jul 2023 22:32:36 -0700 (PDT) Received: from localhost.localdomain ([82.78.167.79]) by smtp.gmail.com with ESMTPSA id 21-20020a170902c11500b001bb889530adsm319059pli.217.2023.07.26.22.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 22:32:36 -0700 (PDT) From: Claudiu Beznea <claudiu.beznea@tuxon.dev> To: mturquette@baylibre.com, sboyd@kernel.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, mripard@kernel.org Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, varshini.rajendran@microchip.com, Claudiu Beznea <claudiu.beznea@tuxon.dev> Subject: [PATCH 01/42] clk: at91: sama7g5: check __clk_get_hw() argument for errors Date: Thu, 27 Jul 2023 08:31:15 +0300 Message-Id: <20230727053156.13587-2-claudiu.beznea@tuxon.dev> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230727053156.13587-1-claudiu.beznea@tuxon.dev> References: <20230727053156.13587-1-claudiu.beznea@tuxon.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230726_223239_939386_E4A750CF X-CRM114-Status: GOOD ( 12.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
clk: at91: add support for parent_data and parent_hw (take #2)
|
expand
|
diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c index 91b5c6f14819..16e458be8304 100644 --- a/drivers/clk/at91/sama7g5.c +++ b/drivers/clk/at91/sama7g5.c @@ -988,14 +988,27 @@ static void __init sama7g5_pmc_setup(struct device_node *np) struct clk_hw *td_slck_hw, *md_slck_hw; static struct clk_parent_data parent_data; struct clk_hw *parent_hws[10]; + struct clk *clk; bool bypass; int i, j; - td_slck_hw = __clk_get_hw(of_clk_get_by_name(np, "td_slck")); - md_slck_hw = __clk_get_hw(of_clk_get_by_name(np, "md_slck")); - main_xtal_hw = __clk_get_hw(of_clk_get_by_name(np, main_xtal_name)); - - if (!td_slck_hw || !md_slck_hw || !main_xtal_hw) + clk = of_clk_get_by_name(np, "td_slck"); + if (IS_ERR(clk)) + return; + td_slck_hw = __clk_get_hw(clk); + if (!td_slck_hw) + return; + clk = of_clk_get_by_name(np, "md_slck"); + if (IS_ERR(clk)) + return; + md_slck_hw = __clk_get_hw(clk); + if (!md_slck_hw) + return; + clk = of_clk_get_by_name(np, main_xtal_name); + if (IS_ERR(clk)) + return; + main_xtal_hw = __clk_get_hw(clk); + if (!main_xtal_hw) return; regmap = device_node_to_regmap(np);
__clk_get_hw() argument in sama7g5 is obtained using of_clk_get_by_name() which might return error. Passing an error casted pointer to __clk_get_hw() may lead to crashes. Thus, check the pointer for errors before passing it to __clk_get_hw(). Fixes: de3383e993a5 ("clk: at91: sama7g5: switch to parent_hw and parent_data") Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> --- drivers/clk/at91/sama7g5.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)