From patchwork Wed Oct 19 08:29:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp223718wrs; Wed, 19 Oct 2022 02:38:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7JX8tSOIRRNgYz80lmvcLfH03dxGrqmhqLSsCeOtTqAHeYng2iEZWwhjxdM1Wc0R7OFiSY X-Received: by 2002:a17:907:94c3:b0:78e:2866:f89f with SMTP id dn3-20020a17090794c300b0078e2866f89fmr5804508ejc.617.1666172297740; Wed, 19 Oct 2022 02:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172297; cv=none; d=google.com; s=arc-20160816; b=nmMsT+KvDwgX3kKbVkjzx33dQuuhVR+x/ugRmgx2dyNlmmEvCed4e43RQva1UpptXe PIT95fqkFMV+R6fxmMqApthc24jCGiVGxWZ1FNi1G6zWnzBJ+4BvE9qZQER0tt/ZSTAc da6zzhLAHsNd5GN30gwMt5+dQLzwmJYHmohUkGcWmQVLwPwJLFUOqamnXs8g3KtOxJeh W7qBaliFnf/4SYLFOTeUM5uSn+WA6fauRHnfv9JJHtPhrPiZedBc4qIm85sWikmgOOx3 q5jdz3gpyfVs0jn20Tr02U3/Na+5iV2NwUGLhPivZaoZYKR5ChVxvsaPrww6psqJlJX2 EPBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zaU51cqQT+cnhauim07kT6C9uoWnky7RpVyX/olHIM4=; b=lT2xxMyjA9fA43PTI1xJUtplP4TUzA/l7rt3j8C0PzVEXVQ0O21PQhEWovS1W3JcQL zAtOQv0Hz68lKRM6LXf80PSZ3O1SHoY2uduqbH3qBYfO5QfGxThuprAStxeI9mroKmWN 2PgWZs48zq97xMX+TighVfleXbvZbaoWzKU7CbRJ+iyPuoVHz89v6P6FRHlzX3dbF2nI mPKzv4+/NVQM0toCZay0zwHcGlddikshAVF3S9NOdSAUnrw0t79edaAIzPbVFEOSrS3A D3cNA4u7XYCK+nFSkGtSguSsuY7SoAn7/d6f1OJcY3XAqQQmKtT3ZgflI7eIEcTDJaEJ +EjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a+JaT81r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b31-20020a509f22000000b00453aa9656a3si11958500edf.466.2022.10.19.02.37.50; Wed, 19 Oct 2022 02:38:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=a+JaT81r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229891AbiJSJWd (ORCPT + 99 others); Wed, 19 Oct 2022 05:22:33 -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 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747108283327737022?= X-GMAIL-MSGID: =?utf-8?q?1747108283327737022?= 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);