From patchwork Fri Aug 16 07:54:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13765655 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 38B0FC3DA4A for ; Fri, 16 Aug 2024 07:57:38 +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:References:In-Reply-To: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:List-Owner; bh=R3rfqVHruVOGC2FYVz0rFlsxOciO54KGc2d/kghQsw0=; b=oouqW4/qOFY8LmpYflOsg0UMoI VbSHhTqpsUUtclJICb18WpfO+KUBQnMHXRhzRrnPk9C0KrgSZTrtUmAoROpB4RLREx+BJn+szk5LE GSlusZtrcIi43zuKNoFzJQJJHR8dk79gEBY4rDPfnec/xn0axzhdI6vhYrRNQ+X4qSIrxEvM8G5g7 UvmMmZyOIdk3oc+FflBK+Kbstg6kUXLg7QwnaTSxZbmHC7yt0FO2vDcZ2Nl4Xw0BE2WFYOqfT2eAW TUHBV0WBMr2BC68ad4lWMIUWtvl+MiMQZ4HwF7Dalyx/ikXB003gaES/DHlZr79tpgRhUcSrcbcYS X882qnAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1serpr-0000000CCAv-0vpi; Fri, 16 Aug 2024 07:57:23 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sermr-0000000CBQV-01aw for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 07:54:18 +0000 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-369f68f63b1so987814f8f.2 for ; Fri, 16 Aug 2024 00:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723794855; x=1724399655; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R3rfqVHruVOGC2FYVz0rFlsxOciO54KGc2d/kghQsw0=; b=hcLXPCn1LeLE2yMtQlMJ2QAMZg6Rpxg3bKXFXEAdHA9XKePebBYRIlExZdIFJqRCpO 2sZElKNdAQOozhQvGk60V0JinfJCfyfYgw4y5Umvtca94goC2KLlZCrHxo8Y0hU1JAji O1+1If82TIr/fH/PBpE5s4NdnlSCW07CB4y+oax5jbiFvjsq9f/5Mt2PWakhGOKsIAcn w6ElY72caiwYpxajO2a+pdUfTzoJXSK6K86SrIwXLWR9lZI2LIBdFFoDW7AxztZRx1/u q4PhPTvbkBH0qVOpFI62KM3EAiJ/ePrJS6eyeH/4WH4LwhslWT8XeNzokQyobONwf428 00Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723794855; x=1724399655; h=content-transfer-encoding:mime-version: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=R3rfqVHruVOGC2FYVz0rFlsxOciO54KGc2d/kghQsw0=; b=dSvHA6t1ZpWD9fW9kvZVY0WUx3T/8Cq9yZDSvn2LJ2VicN3hE6ExF3+PFLinK8tron rL7/Cspfho98WsYSCHYgGVNhZE0ONza+hW7mZz4a7By7K4Nai3fVPgP1YU+jbUdJN79q DaIpKc65+9g/1SKXXzx2PHYehe6Kxp8y1VYkwXf7T7TaHKMU53Gh6jfVT/LOg093lE7r 7EX6467Pqc0UJggVsz2NMjx694dspxL4KvfQjSEBBBme5FtFJcNHwEeLbd9sJazMaf5d pxig4qExBAV/SmtUU4LCxlFB1IZ0P2Dl2bQTO/Nh2T2uLdE0Iq2Xz2ddPczQsbzvDvJL sYog== X-Forwarded-Encrypted: i=1; AJvYcCX4RyZ5qJ65ZtwTqX2YGUMnfWcug26YMzX56R/9HRgpzyMK7lwZNr8ayrYPo/gjwO5UXMMqnBye5EiIXTugdVGYaoic8GuFN0g9F+C/nZ3PJqSrpvI= X-Gm-Message-State: AOJu0Yw7UwZ4eGLgOfrj82OtyaPk+hjca3D3+VTUiNbKo6jxuOGysplk er5UXya6diTErVQ76FkgSMOPs/7U3lGDJVS4pXo8InK10iHwnH/eLTO3pKct1Ww= X-Google-Smtp-Source: AGHT+IELJsEIdJrzfxRlYTFmph//NPsFzW/KOkCn+6qANqNPjCBjFgoONw7BALUdqn6MkGE37+0afA== X-Received: by 2002:a05:6000:dc4:b0:364:6c08:b9b2 with SMTP id ffacd0b85a97d-371946a3dabmr1036836f8f.45.1723794855161; Fri, 16 Aug 2024 00:54:15 -0700 (PDT) Received: from krzk-bin.. ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37189863109sm3049587f8f.65.2024.08.16.00.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Aug 2024 00:54:14 -0700 (PDT) From: Krzysztof Kozlowski To: Thinh Nguyen , Greg Kroah-Hartman , Michal Simek , Vignesh R , Felipe Balbi , Grygorii Strashko , Piyush Mehta , Radhey Shyam Pandey , linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH v2 2/2] usb: dwc3: xilinx: add missing depopulate in probe error path Date: Fri, 16 Aug 2024 09:54:09 +0200 Message-ID: <20240816075409.23080-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240816075409.23080-1-krzysztof.kozlowski@linaro.org> References: <20240816075409.23080-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_005417_093717_E89377FE X-CRM114-Status: GOOD ( 13.12 ) 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 Depopulate device in probe error paths to fix leak of children resources. Fixes: 53b5ff83d893 ("usb: dwc3: xilinx: improve error handling for PM APIs") Cc: stable@vger.kernel.org Reviewed-by: Radhey Shyam Pandey Signed-off-by: Krzysztof Kozlowski Acked-by: Thinh Nguyen --- Changes in v2: 1. Add goto also on pm_runtime_resume_and_get() failure (Thinh) 2. Add Rb tag. --- drivers/usb/dwc3/dwc3-xilinx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c index bb4d894c16e9..f1298b1b4f84 100644 --- a/drivers/usb/dwc3/dwc3-xilinx.c +++ b/drivers/usb/dwc3/dwc3-xilinx.c @@ -327,9 +327,14 @@ static int dwc3_xlnx_probe(struct platform_device *pdev) goto err_pm_set_suspended; pm_suspend_ignore_children(dev, false); - return pm_runtime_resume_and_get(dev); + ret = pm_runtime_resume_and_get(dev); + if (ret < 0) + goto err_pm_set_suspended; + + return 0; err_pm_set_suspended: + of_platform_depopulate(dev); pm_runtime_set_suspended(dev); err_clk_put: