From patchwork Tue Oct 1 10:57:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riyan Dhiman X-Patchwork-Id: 13817784 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 24F69CE7D12 for ; Tue, 1 Oct 2024 10:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=+XodivF81UWtP2cNwWOGWcI/Uct7qBUohMsaji6ENUY=; b=xbpBRXB3RrgjefIjfXd54624jy 9+eho01Qc01/8C3/jWSortQS6b+pNjoFcfqThlMmxAS91pB7HAAkL5FZsEsnrY6DXFRV5Xw92xXe9 T3onw9Gq9KY18DOVU7MhestFL0LgHH8OJ/GHZLhV6TsKs8gPIZU4oC+LxPAr0cQ18NsZ4fTr7HEw0 s5Cl/4K6hoYqUd6cgDDMzPk8Lc+Dg45uSv6Kqbot5/vcZoIgOPm80R3scRQORXcoV9kP9t+/2BrEY dUBLue3VGUuRntgAM0b8+di/Qvr8Um3mJfnW2e1zSt+dfwpNZthR31GSX7l5mXlEpzt+N5IlaI8Bl lFaUO0kA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svaaz-00000002QUe-3xG5; Tue, 01 Oct 2024 10:59:10 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svaZm-00000002QMC-1kY5 for linux-arm-kernel@lists.infradead.org; Tue, 01 Oct 2024 10:57:55 +0000 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-70b2421471aso3319084a12.0 for ; Tue, 01 Oct 2024 03:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727780273; x=1728385073; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+XodivF81UWtP2cNwWOGWcI/Uct7qBUohMsaji6ENUY=; b=IFHv/vyRV0Ui9GhBBAt0ef9bUq0vbFsI+D3ieceC1sSPpokfjidpzV+g832Fx8ejXH 66ItcOCqT0vX/8jr2jsGx6V4CDvS/FhROAVLSPUj+Gf0ApbDr3wVRlCNism13Cr/rypG qI3wbkaVo8CFLmmgayUuLY7OAYtFGapLwMn+Tnofs8Dyo79p+OJmGbd1fQw9gu4dLW04 ndNVI6NpXgDQGl1KZ/Q/s2WTVCO3z6hCBeKVsAZDxOjpQb11Y425mKXuuq8CDGF9qv0a jJ5cvPA2AdJcV/2Wl9Yb8IKDqn6BzP1cud0TqlB4f1PfcdenI6XiGRxQ7HiHO0UWvu/K r7uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727780273; x=1728385073; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+XodivF81UWtP2cNwWOGWcI/Uct7qBUohMsaji6ENUY=; b=RLR2xzOu/8Dbhh8tUIwsO3adL0/5mCvzbxoFGnN8cwXlPowkydDF7ADr9zMwuKN8Q9 1+ZeAEP0s8KcCSX3qaURV95r6fWC3eQGwzQZqMEkH232D6lybmE39UU0/HTLVfjLbbgq Mkm6dGXEh6LydiYQOrcjA824YzIYQD8lFZxfAELu8oICoMJH3xU6Ps+mSQTwox7m3TNZ jHTJPkm3tRe5kfzw9AhW7Xa92swKGoK29vncFXCPnqAM8/zy9bbXMJEZcaCS+KyF5skk 63CRA23M/EhAAReGsbObhf1BPtYoiqeVVwqxrFXEDtpLPMw7imaT2e2gW1YaZLfeGCp8 ving== X-Forwarded-Encrypted: i=1; AJvYcCW7Osj72pWehDYoLbP/O9J0jC1+z3LxOpW6yV710XiB7etl+tM/AfgAJtjI2R13iqQuxJJpANJ4mazeV/awtzzT@lists.infradead.org X-Gm-Message-State: AOJu0YzucsfxAx4iFAuVhn8tzEk3qSDKT/AugmzLvSnY4vtlZmJ7GewT 4MsqRWHygwnz70Y89ki2U5XG4Z5zYJkt24tolk1ZF3oDVntLlEA2 X-Google-Smtp-Source: AGHT+IGhZN9+wVKG14eYUdsgaPGOEoVAZRpX351sFX9Rh29MejCBf9Qb4pmMk6uv2ceETeAVZBeWUA== X-Received: by 2002:a05:6a21:1193:b0:1c4:9ef6:499b with SMTP id adf61e73a8af0-1d4fa6cfd50mr21889572637.29.1727780272943; Tue, 01 Oct 2024 03:57:52 -0700 (PDT) Received: from fedora.. ([106.219.166.49]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7e6db5ed0e9sm8069195a12.57.2024.10.01.03.57.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 03:57:52 -0700 (PDT) From: Riyan Dhiman To: vigneshr@ti.com, s-vadapalli@ti.com, lpieralisi@kernel.org, kw@linux.com, bhelgaas@google.com Cc: kishon@kernel.org, linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Riyan Dhiman Subject: [PATCH v2] PCI: dra7xx: Added error handling in probe function when devm_phy_get() fails Date: Tue, 1 Oct 2024 16:27:18 +0530 Message-ID: <20241001105717.4566-2-riyandhiman14@gmail.com> X-Mailer: git-send-email 2.46.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241001_035754_478611_EF78D09B X-CRM114-Status: GOOD ( 13.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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org While creation of device link, if devm_phy_get() function fails then it directly returns PTR_ERR without any cleanup of previous added device links. Added goto statement to handle the cleanup of already added device links. Fixes: 7a4db656a635 (PCI: dra7xx: Create functional dependency between PCIe and PHY) Signed-off-by: Riyan Dhiman --- v2: resend when tree is open and reformat commit message drivers/pci/controller/dwc/pci-dra7xx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c index 4fe3b0cb72ec..c329d107b811 100644 --- a/drivers/pci/controller/dwc/pci-dra7xx.c +++ b/drivers/pci/controller/dwc/pci-dra7xx.c @@ -762,8 +762,10 @@ static int dra7xx_pcie_probe(struct platform_device *pdev) for (i = 0; i < phy_count; i++) { snprintf(name, sizeof(name), "pcie-phy%d", i); phy[i] = devm_phy_get(dev, name); - if (IS_ERR(phy[i])) - return PTR_ERR(phy[i]); + if (IS_ERR(phy[i])) { + ret = PTR_ERR(phy[i]); + goto err_link; + } link[i] = device_link_add(dev, &phy[i]->dev, DL_FLAG_STATELESS); if (!link[i]) {