From patchwork Fri Nov 19 22:07:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 12693154 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 C45BEC433F5 for ; Fri, 19 Nov 2021 22:09:55 +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=Tcc0tXdqap5n36 rQbecRwnyFhX+iW4cXnEYOYBB6iB5qlCAnECq7Qt6yBSpEsRChAjTzhWAFGX9z/Z876xMkEANygjZ IAgzNpcCnYvUzcoCa4oP3SqMo5WpUgiOpYd1wPOyvP055HptvDfqxqAqf/x22U6NQg/wFCBxLx0pv /B1xL3kMrgN54Jk/bHoil6qHh7ve1jQCPrOWIsbw1URQM/9cWC4kQYS1EPO2LUmmADkj930IXAiJp 4s9X1zk4pCv+65IGdjuPaU+19c9fM+hig55XfA1NFlNGq7nPDonWvxvIps0RwQ1fKiczD66mCK/c2 mLof7gd4ZsE4XEs53GJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1moC3U-00Bdyt-Gs; Fri, 19 Nov 2021 22:08:24 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1moC3G-00Bdsb-7X; Fri, 19 Nov 2021 22:08:11 +0000 Received: by mail-pj1-x1033.google.com with SMTP id np3so8894550pjb.4; Fri, 19 Nov 2021 14:08:03 -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=mdTN4XDtNAPQv/72+dhoCFCoxzdfJEdUOuV2E6IjFSHGq7ARXOXM+gVCLtD878WAuV 8eZDGyOkFVOSVG7IYqhgBthLvaYyx4aSunqvokXa4wkp2D3+GlqpQbFbg6x0n+PEiDMK c8xwjWMlUDSQQhbtB76wwk/nEQWLomvM5ckraA06dkwlqDXtkx28Z1YK8hh+IH9EMUao 3zoLQja652aZw8RwZh3EWaA/X3ld6CnyLl6xEGslq3PxWWPVtJrP9KmnwQ4b4/+J6ufo erpvIXtkld22/LCru4axk98shP1D0qxNpTqq+eiFjF55UJ9VmfeTEB8RikE8a/cUWEGI ltdQ== 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=YOuZKKaIfs57jISPZPZw9FbvxkiYdWeeTXvuF8CSSZZANRUST+DgTaWu1wWqNfqfnW 9B6m8JK23K1fcRUhCkgm5Mf3NqTjfa9ZEQ+1pNnJUVfPZruT47LEm6MpkzTc2ZwasB6L MCY6++9bWZCyMW9S8C1xy6SeC915yc8tCPZc/pj0xTRFly0DGmS7gRXbHA34lGQe5vQ6 7tu6w5T8pnaRrdaOAcw3zR1M4k1JwG4VzAnHWCbQvTRO5SfSJTUregMOUulF4Bye8Q0C 0Up7irJOvs0/trp6wjH0jLlNsLwVriw0xcEGpaeaxgtmR2VxrwYt7gqnYctPhtscILfN /FAg== X-Gm-Message-State: AOAM530g0OCqPsCO3zOr+HFJ588qtyALxhYLy/SEOCj/kr+LZI1WfALF 0fGzoBua5Lpkxy4xAJbzsGkFBDKDrBkf/g== X-Google-Smtp-Source: ABdhPJzyF20Xa2xvnCY+FSmR4kmroEp3K2+l/gI1fE9Qa5W3WAlNK5vIJABvOyqRzIDhyXuv1sQvog== X-Received: by 2002:a17:902:7fc5:b0:143:6d84:88eb with SMTP id t5-20020a1709027fc500b001436d8488ebmr81623886plb.61.1637359683454; Fri, 19 Nov 2021 14:08:03 -0800 (PST) Received: from stbsrv-and-01.and.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id t2sm612940pfd.36.2021.11.19.14.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 14:08:03 -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 v9 1/7] PCI: brcmstb: Fix function return value handling Date: Fri, 19 Nov 2021 17:07:48 -0500 Message-Id: <20211119220756.18628-2-jim2101024@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211119220756.18628-1-jim2101024@gmail.com> References: <20211119220756.18628-1-jim2101024@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211119_140810_294381_91371351 X-CRM114-Status: GOOD ( 15.48 ) 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 --- 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); }