From patchwork Thu Dec 9 21:13:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12695524 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 9D882C433F5 for ; Thu, 9 Dec 2021 21:15:58 +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: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=mW3R0iqWubjPkXpXjV99RH+NCeh+GT+Se9ooFIeUPj0=; b=U3z6gH+Mqfhg3Q piyzh9hCxEzP9zerJu8nDS6hwyCysQLbY2sOeJ5iuCoK1csX1DG97OeGW0YDOkrrPVYwRkY8rCXht /uRM2sPO9WNUyGl0LlmaikR6DYzEbP/PPmIP2XiJfhqlfT+mv27LvAinn2minh+35ePowlFgx2wrZ 6J17PAN/sc+CfUMSdJJEVxV8A4jEuKAwaM0PuAcz6ihVGadO9sfVC7qnvBLAqiY9yeWzE7cI2zPoG 7tRQwZva5omYek2Re0CRTW+e7j9BXQOj2eVamcYD2syBe1blt7fplYdt/N5d7Xoe8glxF8JmQEni3 Q5aSuw5IL/rgtJxmuj8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvQkI-0000qX-4U; Thu, 09 Dec 2021 21:14:30 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvQk5-0000lt-M2; Thu, 09 Dec 2021 21:14:18 +0000 Received: by mail-pl1-x635.google.com with SMTP id u11so4853069plf.3; Thu, 09 Dec 2021 13:14:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+zcuXFbqK8H0xdNFwVNSeclVkixsgVOiV/M+oI0ZGTY=; b=jSJTycM1LHfsqch9Tn+iEzckPdBUoUSwsZSLvvFvx9HL1d+3H2meXR8c2PgUIVDIbm +2sOF0dBLdEyARpv2FiufUTh9W62UGUm1FzD6U+JkKBt7WViSRUz1Q+IdZyl1pUurE4Q uceVQ2eDN/K4tY6dUKa3NL+Ke4WoeRwPmUHDc7dp0SOszJ9kbtl0uoS8tmx9JXHyiUoa PyoeYc2RvC+w4SLaB3JjGkiUb2jV0kFLwElzvvl8RxdaP9JwOw9RufhCQmhmr1105+// IqYatHMACCNAWcYJXkaPbv6lkxYfqlDB8gymqQoM6hBvWaK8KNDd8QmrFGMm8BCuUC8y UIew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+zcuXFbqK8H0xdNFwVNSeclVkixsgVOiV/M+oI0ZGTY=; b=fzXQXZ63cqmA1L+DKaEV3ZlBb05IaYwTJxqGyb8NQCwuaNcjS72TlwBBLg3LQNf6Ub UXXDyJfoCChMN9kyygzyU1wCF+r74JQRfhy76/8urNboqZTmNOYpDa5mafT8R0REUczl 54UsCSCuWaanoQQ+dGjDB45WRc8HflBQFCI7awZ9/MynIuxiRXx6jKkJh/KAOI/3dq/l d1rBvZybzUnDj30CKehfBC32AdxuuSiNCbM1U8SU+aY2SxEGvlWeqzYnBDdy3I2RditX UsB0mKIoBRJ+pLVxjw+bzzI2Esx0poGtyV3jcc4k8R6ycMnttvp0y6PNHNX4x53hOPCW yxkA== X-Gm-Message-State: AOAM530C1l9b57IOAJ1azTlKnjqgrxXdQn0YuJ29p2XP11kHCTcoqK86 OapdWjHIH02twfNwx/a9tfk= X-Google-Smtp-Source: ABdhPJyX/WNjlHXzEOS9kK07DY0dM2ycqsaHaQnGFsuHE4Oc6LPhdzvaWvbMeLDlO1h0yNCKdee+5A== X-Received: by 2002:a17:90a:5d8b:: with SMTP id t11mr18548215pji.8.1639084456602; Thu, 09 Dec 2021 13:14:16 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id y4sm617800pfi.178.2021.12.09.13.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Dec 2021 13:14:16 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Bjorn Helgaas , Nicolas Saenz Julienne , Rob Herring , Mark Brown , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Philipp Zabel , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v10 1/7] PCI: brcmstb: Fix function return value handling Date: Thu, 9 Dec 2021 16:13:59 -0500 Message-Id: <20211209211407.8102-2-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211209211407.8102-1-jim2101024@gmail.com> References: <20211209211407.8102-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211209_131417_748983_D24EC5C5 X-CRM114-Status: GOOD ( 15.07 ) 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 Do at least a dev_err() on some calls to reset_control_rearm() and brcm_phy_stop(). In some cases it may not make sense to return this error value "above" as doing so will cause more trouble than is warranted. Signed-off-by: Jim Quinlan Acked-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 28 +++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index 1fc7bd49a7ad..9ed79ddb6a83 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1146,11 +1146,23 @@ static int brcm_pcie_suspend(struct device *dev) int ret; brcm_pcie_turn_off(pcie); - ret = brcm_phy_stop(pcie); - reset_control_rearm(pcie->rescal); + /* + * If brcm_phy_stop() returns an error, just dev_err(). If we + * return the error it will cause the suspend to fail and this is a + * forgivable offense that will probably be erased on resume. + */ + if (brcm_phy_stop(pcie)) + dev_err(dev, "Could not stop phy for suspend\n"); + + ret = reset_control_rearm(pcie->rescal); + if (ret) { + dev_err(dev, "Could not rearm rescal reset\n"); + return ret; + } + clk_disable_unprepare(pcie->clk); - return ret; + return 0; } static int brcm_pcie_resume(struct device *dev) @@ -1161,7 +1173,9 @@ static int brcm_pcie_resume(struct device *dev) int ret; base = pcie->base; - clk_prepare_enable(pcie->clk); + ret = clk_prepare_enable(pcie->clk); + if (ret) + return ret; ret = reset_control_reset(pcie->rescal); if (ret) @@ -1202,8 +1216,10 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie) { brcm_msi_remove(pcie); brcm_pcie_turn_off(pcie); - brcm_phy_stop(pcie); - reset_control_rearm(pcie->rescal); + if (brcm_phy_stop(pcie)) + dev_err(pcie->dev, "Could not stop phy\n"); + if (reset_control_rearm(pcie->rescal)) + dev_err(pcie->dev, "Could not rearm rescal reset\n"); clk_disable_unprepare(pcie->clk); }