From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 146D3C433F5 for ; Tue, 16 Nov 2021 01:24:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E19006137E for ; Tue, 16 Nov 2021 01:24:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351042AbhKPB1a (ORCPT ); Mon, 15 Nov 2021 20:27:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:39116 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244017AbhKOTIX (ORCPT ); Mon, 15 Nov 2021 14:08:23 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DC79F6349A; Mon, 15 Nov 2021 18:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1637000256; bh=susqupJ+Dygupq88Lp3tGxosSgZU+Qn+gXubyF3rN+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sOj5YVoZsVJePQjAR4G0E2zkQhI94YW/etmvKcI/qwwma8GVvR/7ktl3zcIJph9I2 yrhGlBj+/wgD6AFHoiSqlodlwCIR0VC5EGZkC1sm/lpi2yE8YPhCCx3d9ziHwknwpD ll0drstLpn9aRSgPlJCbT/ZvOcQQa95qxgGWxWyc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Nicolas Ferre , Claudiu Beznea , Stephen Boyd , Sasha Levin Subject: [PATCH 5.14 594/849] clk: at91: check pmc node status before registering syscore ops Date: Mon, 15 Nov 2021 18:01:17 +0100 Message-Id: <20211115165440.346513132@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211115165419.961798833@linuxfoundation.org> References: <20211115165419.961798833@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Clément Léger [ Upstream commit c405f5c15e9f6094f2fa1658e73e56f3058e2122 ] Currently, at91 pmc driver always register the syscore_ops whatever the status of the pmc node that has been found. When set as secure and disabled, the pmc should not be accessed or this will generate abort exceptions. To avoid this, add a check on node availability before registering the syscore operations. Signed-off-by: Clément Léger Link: https://lore.kernel.org/r/20210913082633.110168-1-clement.leger@bootlin.com Acked-by: Nicolas Ferre Reviewed-by: Claudiu Beznea Fixes: b3b02eac33ed ("clk: at91: Add sama5d2 suspend/resume") Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/at91/pmc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c index 20ee9dccee787..b40035b011d0a 100644 --- a/drivers/clk/at91/pmc.c +++ b/drivers/clk/at91/pmc.c @@ -267,6 +267,11 @@ static int __init pmc_register_ops(void) if (!np) return -ENODEV; + if (!of_device_is_available(np)) { + of_node_put(np); + return -ENODEV; + } + pmcreg = device_node_to_regmap(np); of_node_put(np); if (IS_ERR(pmcreg)) -- 2.33.0