From patchwork Thu Jan 6 16:03:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12705519 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 2AAC8C433F5 for ; Thu, 6 Jan 2022 16:05:24 +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=/jcKETsCZf9mllWZX+tctA+aage2GXKt6zJo21GyFdE=; b=2C1Hy4nKTTQ9ln EjTbHJTR00X2aAtlAET3+qYQxfFx5je0D2qPVKsLmJ+733aEnzZgAxhe+/8/wuupWT3rEFzd6yCy3 ysKnLOq7eSNJw2DtlCWXxzZ+fS3i1dECUMdgwD93ClGwgLc3mUlf4WvsTUsfi+puYwxouR7a04DeJ VXy1jChkvVCd+c+WBIU/cIZW+Zg3yj914Yyd4YuosyOCxiGVjG+6ncmPoPKdzT+tZQ8B++c7w5O4d F4F3dM631nTb5p0CkkoGTfdgc1eJSymSYGwX5JiTuXUkLOKa2tg1NwsNgwxDihRnLFS3TkxDF3AyT iRL+ITz1uFqLFcn/wk/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5VF3-000X71-PT; Thu, 06 Jan 2022 16:03:53 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5VEs-000X2B-Tz; Thu, 06 Jan 2022 16:03:44 +0000 Received: by mail-pj1-x1030.google.com with SMTP id l16-20020a17090a409000b001b2e9628c9cso3644125pjg.4; Thu, 06 Jan 2022 08:03:42 -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=ny451XICFZwmv/3fN6tVd1MtvFhizeu82dbPq5GZyWM=; b=B/bJAL+9WSowS7PoK06mmDrVzgt02eyDNMsOWEOFLOz29VKdblVemN9wxL2Ccjd95k EAIK7FXwe8LOSzGZwiPhVH+P4sFunR8RsBApeS62FyHromHaN5VBGkMdkGuks/1RbBWB md2Z0Q/otAyw2fW31yMaY4NE5wkXrgPE7cLxV9PmbhumzUzbhz5sOlJKIz3G+93dr0g7 1xWVLRyy8kCXpTCrueZEUpklpuzpEIjVXARZ5rUNbhT14JVnann1dvfVOcNqyFHI8FpP uFFfRSgE89MaJ018xedf63DocBR1C+/enZpDOa09Y5jKPChPe/wzRkUeinHhUGYZuRCq d/5w== 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=ny451XICFZwmv/3fN6tVd1MtvFhizeu82dbPq5GZyWM=; b=stxzCU9IeKdzr1NPcaRcYnguXWYnS2xvomLIUfl87brolxO473xTMPaNXjXsK4gpZz HVSoAmdHUt1xGTbpvtUuqoFZh6rJzF5eoaH8VR34wVMOEGzTXFoH+aQD5T+3B6DPFK9f R2Y1U7kcydmzKP45031JpOAEHT+GcMi55Q//4c2raWeXwCCcEPdQeOeISkANeFH9GoYM p9vPX4OKVVOiBA2qHnxk6WZRMmN/TSY9Eeb8YxljhLWyZb0ARmpIYbnqSWeBqBT4fhwB +rHJVTXIDxsTXZbZ4Q1yCqyEmd4eOQ7mMR0AoUWuNme6SEdG5NFJPx7PopkpgAaLM5pk ahng== X-Gm-Message-State: AOAM532EoYZuwd71jwefleQN8AoKDHKDmdDlLsJqlxh1AOJGbpHumciP AcuFDkx0uoo4pkOw0SvpH8w= X-Google-Smtp-Source: ABdhPJwVNSM8XJAXkqDKNJQgq2zUYGKTki3fMD3qLUZ5nTowM5+y0ryglm3I1q3luY/LPCHnXG++bg== X-Received: by 2002:a17:903:244f:b0:149:873:e17c with SMTP id l15-20020a170903244f00b001490873e17cmr58362526pls.133.1641485021987; Thu, 06 Jan 2022 08:03:41 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id q19sm2376316pgb.77.2022.01.06.08.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jan 2022 08:03:40 -0800 (PST) From: Jim Quinlan To: linux-pci@vger.kernel.org, Bjorn Helgaas , Nicolas Saenz Julienne , Lorenzo Pieralisi , Rob Herring , Mark Brown , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , =?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 v11 1/7] PCI: brcmstb: Fix function return value handling Date: Thu, 6 Jan 2022 11:03:24 -0500 Message-Id: <20220106160332.2143-2-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220106160332.2143-1-jim2101024@gmail.com> References: <20220106160332.2143-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220106_080343_007245_A803AFC9 X-CRM114-Status: GOOD ( 15.24 ) 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); }