From patchwork Fri Jun 28 20:54:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Quinlan X-Patchwork-Id: 13716580 X-Patchwork-Delegate: kw@linux.com Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8E407FBA8 for ; Fri, 28 Jun 2024 20:54:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719608085; cv=none; b=NVtz2vT1m9TQ5DyWKSIvzUWLKDA5wT5NoBMFx5jo6OGwPmPdaZpifrqn4XZzUwfIdLgu+vGq1gzu1r3ySsn8mPARpwJIlwaD0QPmeOyZIigxP0DZ5LQNZ6Pn7cy+AU9Qq6zQQEc/Tl6b1in6r4W5dBd6K7gGYmb4/tfzUPcvc0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719608085; c=relaxed/simple; bh=rC++sZ1RZfxUIcMgS1w64RKH29YFR4Pde3aMM5NpvsU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type; b=GN6oGeDlR1jR/7ivYgPbO6XTtDGzFtMoQs2yoIRT3x5w/knOQMHo3wk07B26i9kfsza1mDL+6lL6bvSYwadmZ+SmuebwKdPrJkBwiTfZ/EB6/6WT0cC6o9DtcqdrTt+2Dn4vPjYibqeZnZnc02JQlvgAZLYfJp4L3b2mO2ADBko= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=Y33ERjkH; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Y33ERjkH" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-70670fb3860so803681b3a.1 for ; Fri, 28 Jun 2024 13:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1719608083; x=1720212883; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=7ylex07+kfE9xuykW9odNeRYshlqzTBnx28DddXYqQw=; b=Y33ERjkH9iJ5+AsE30y0Zzx7GaIHkfo5H+S9ypIm8T5xT5YuAMF0ImgCOF5wQ3eaLy NgUER0dNxTVgY8+Tjmivjc7RkiCmQhJhJGcESym47v2axKRyzSlDDMw82ewdrfUUmcq5 RNz/07UwheVBJilf6LZsG3IkDRxqGORHlSjR0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719608083; x=1720212883; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7ylex07+kfE9xuykW9odNeRYshlqzTBnx28DddXYqQw=; b=PJF8AaNZhEnwVCS3t2WsufVEjhwgl8yip1VyKxx3YcAMqTwAk31WFQuW1Jj/BwKc17 jil8nMjb7QMQWmDZm3p0LLQP6yTCknZsu9q7mzROq2W6GqcZTVmAU+Y2tnHi0laamDLI rDtcNfIkCCeRKCN5YAInm+rgfyQA3RGj8zBPSTkS9N1mB0kTs6Uzu+kVC/VR9p//0j0e 4pben6JXufzrkDnVJNeux0s+7LErmwCHkWAsHk4AGhD9LYckushjIXsMpBsHe1XAa34o l/HGZa8mwLmcTZ5IRe9XTyZLGaclchm+hgsPgXr5s4d2nO+xf2mDexKSpogNAY43ff9R vFNw== X-Gm-Message-State: AOJu0YxQ6v4MpnD6zFKNtGH60iYPQvvrhlnqrweHBntQOxCAy8Svcf9R PEeWm4g9eciGC693Qu5SSivgcPkd3HJQqgTkIZVgVsiOkK59YSEmYXeQEOcpJxbaJy0a5yBT1O8 gGyDTyV4PSnnHXdjrTDWszBJ5iOisejh2huKQIyubRd1CaVXTJVIFRUCvadj1/d/CtEJzk8vgg7 jWNVRTn3KkijIjfDhctW6lSP++10eDHo7oAvLRLk4jp9FMW/XR X-Google-Smtp-Source: AGHT+IEjEyzsDfVcrmM1ByRve/0wh2Kf3Gn6sPZupq9P8Kzpcsawn6x/9OP/l3k9kT5VC/EiWbN/+w== X-Received: by 2002:a05:6a20:734f:b0:1bd:2b58:c62c with SMTP id adf61e73a8af0-1bd2b59f156mr12722475637.53.1719608082554; Fri, 28 Jun 2024 13:54:42 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.144.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac15393d1sm19695135ad.157.2024.06.28.13.54.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 13:54:41 -0700 (PDT) From: Jim Quinlan To: linux-pci@vger.kernel.org, Nicolas Saenz Julienne , Bjorn Helgaas , Lorenzo Pieralisi , Cyril Brulebois , Stanimir Varbanov , bcm-kernel-feedback-list@broadcom.com, jim2101024@gmail.com, james.quinlan@broadcom.com Cc: Florian Fainelli , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , 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 v1 2/8] PCI: brcmstb: Use "clk_out" error path label Date: Fri, 28 Jun 2024 16:54:21 -0400 Message-Id: <20240628205430.24775-3-james.quinlan@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240628205430.24775-1-james.quinlan@broadcom.com> References: <20240628205430.24775-1-james.quinlan@broadcom.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Instead of invoking "clk_disable_unprepare(pcie->clk)" in a number of error paths. Signed-off-by: Jim Quinlan --- drivers/pci/controller/pcie-brcmstb.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index c08683febdd4..c2eb29b886f7 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1620,24 +1620,25 @@ static int brcm_pcie_probe(struct platform_device *pdev) } pcie->rescal = devm_reset_control_get_optional_shared(&pdev->dev, "rescal"); if (IS_ERR(pcie->rescal)) { - clk_disable_unprepare(pcie->clk); - return PTR_ERR(pcie->rescal); + ret = PTR_ERR(pcie->rescal); + goto clk_out; } pcie->perst_reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "perst"); if (IS_ERR(pcie->perst_reset)) { - clk_disable_unprepare(pcie->clk); - return PTR_ERR(pcie->perst_reset); + ret = PTR_ERR(pcie->perst_reset); + goto clk_out; } ret = reset_control_reset(pcie->rescal); - if (ret) + if (ret) { dev_err(&pdev->dev, "failed to deassert 'rescal'\n"); + goto clk_out; + } ret = brcm_phy_start(pcie); if (ret) { reset_control_rearm(pcie->rescal); - clk_disable_unprepare(pcie->clk); - return ret; + goto clk_out; } ret = brcm_pcie_setup(pcie); @@ -1676,6 +1677,9 @@ static int brcm_pcie_probe(struct platform_device *pdev) return 0; +clk_out: + clk_disable_unprepare(pcie->clk); + return ret; fail: __brcm_pcie_remove(pcie); return ret;