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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0CF8C433FE for ; Wed, 19 Oct 2022 09:22:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233433AbiJSJWb (ORCPT ); Wed, 19 Oct 2022 05:22:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233440AbiJSJVk (ORCPT ); Wed, 19 Oct 2022 05:21:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F3E4F38E; Wed, 19 Oct 2022 02:09:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 84A34617E3; Wed, 19 Oct 2022 09:01:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A475C433D7; Wed, 19 Oct 2022 09:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170091; bh=c0R0Pqk7vm5nMDDXB0fP+xSWuyXvMdhOLlZ3l/PnEKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a+JaT81rQTqEfTU1y/587uBieJf6NmrOvBRVA+30WmZBT3x3lxdwoA3JCgjPV0ZrB 8uAdrUMANFvRqr5e0wFrMgrzdRRZ/Ytb04ORuK5AHqZKXw05qWHWGoipngrNCLHj7l +ML/6gZLrwK0hxHoexLCCA2Sp0x+QwGCr4yT9RTY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shubhrajyoti Datta , Sasha Levin Subject: [PATCH 6.0 487/862] tty: xilinx_uartps: Check clk_enable return value Date: Wed, 19 Oct 2022 10:29:34 +0200 Message-Id: <20221019083311.500145609@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 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: Shubhrajyoti Datta [ Upstream commit 957e8c047bf25bd24271ab049f06dc47f382973f ] If clocks are not enabled the register access may hang the system. Check for the clock enable return value and bail out if not enabled. Signed-off-by: Shubhrajyoti Datta Link: https://lore.kernel.org/r/20220729114748.18332-2-shubhrajyoti.datta@xilinx.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: b8a6c3b3d465 ("tty: xilinx_uartps: Fix the ignore_status") Signed-off-by: Sasha Levin --- drivers/tty/serial/xilinx_uartps.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 9e01fe6c0ab8..51fd09e14eda 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1329,12 +1329,20 @@ static int cdns_uart_resume(struct device *device) unsigned long flags; u32 ctrl_reg; int may_wake; + int ret; may_wake = device_may_wakeup(device); if (console_suspend_enabled && uart_console(port) && !may_wake) { - clk_enable(cdns_uart->pclk); - clk_enable(cdns_uart->uartclk); + ret = clk_enable(cdns_uart->pclk); + if (ret) + return ret; + + ret = clk_enable(cdns_uart->uartclk); + if (ret) { + clk_disable(cdns_uart->pclk); + return ret; + } spin_lock_irqsave(&port->lock, flags); -- 2.35.1