From patchwork Wed Aug 14 09:39:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13763203 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 F0C6BC3DA4A for ; Wed, 14 Aug 2024 09:41:41 +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=MGrgEwiDQnCrsN02sqw6lNl+tSbCrY1oNE/v488RmdI=; b=Ir1wUhB4+2Sug1Jp6rA8tFjrf3 IKEqA0tpnvQo9BvB6mLo0p05rnJb4eJLKRPCCmxThM0c2IiVA3T6M+dPeIeQ9fEkz9FJOV9ZLtKPq 16HFSZZcX7hHHtmO0dPhrWSz/OPeNd5eV0PYwsHA/W4xjuizKpehsr4OL2aMEEsv60zG1+VgMt7mv 5OzzLdtIUjZVpctB8kCxXxJnEw72vSZ2Zf1wCywbMewWkWmfUPKlP57hD7gf24dSGVA5KjGxhrzmG xcpEKMZrTRZqtGaCUUvy8ewc8pEQiFRgCV1ite5DrwoBAYYa0/EWFSDt3uEqiShAyXWhUJgNBp0IB D8h5rDBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seAVZ-00000006R9g-0PwY; Wed, 14 Aug 2024 09:41:33 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seAU8-00000006QnY-3YsR for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2024 09:40:07 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2f15dd0b489so83360741fa.3 for ; Wed, 14 Aug 2024 02:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723628403; x=1724233203; 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=MGrgEwiDQnCrsN02sqw6lNl+tSbCrY1oNE/v488RmdI=; b=Ej9dM/J+S4jJb2DayWQq5Xg5hCybz3LBW+M5u2prTVaBrqWexNYaVPsdx98Kk6RtRW EuCiSJmLTsNCn/HkT0QNY5W55cuEvQZRTvFnE6NG2UmXx51Qdmeg6yuM9B33Ig1CtnYf 5w2YHin0SPPAD5G4yETgRTpZfu6CCa010ht8rfZ/xQbf5XXUvx7ZWdTq7S3kyTi6Lx2F NPYcunBr/PiMQs2edrvkKq0N5u03qe+69fOksPdPqQGINyBksdpLqrx9CQzT6amkhXSx MTf4JSU2kyfDod/Ed7D2vxAB5s9tRV1i+oQHRQhqL8dzH8J8q4mI0+XVKQh0WnfVbs0L O8iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723628403; x=1724233203; 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=MGrgEwiDQnCrsN02sqw6lNl+tSbCrY1oNE/v488RmdI=; b=lnXVgNfftBZ5FhPGgXb1wmv9Fv49lsIC6BKdqSvy/5IVgogyq8eq+4pXnfaOEO/+Gk oxK7H+ovEUVhStZCuqizGKnmyw0xiGnpwzAdZ2lCtzrSDXr9wDY8Z3D9TC4A5dghhc4I m8uIqXALGdUeHhkBc/6X4mxBkcdItTEtnrlQXVHVFH5K4XFWOzRf7UOgFIjhYR+2YDt1 w2wTQq6KbLNSs20LSgA0cI6YPAHZRM2tictnH8ChsH7iUvSf5ZfZTjuc/36rxiZi9AOZ N08hfjjJrN2Lz10JZdecWGx94vuILRGp+3p6shmz4dXOLEdY92A5up7+nj0p8h5LS5CO 4Usw== X-Forwarded-Encrypted: i=1; AJvYcCXBzjYMhWVITol/GAK7Jih2fBSNRMqdy0JwCFoE+ehSJew2woDvSltLgFx0u+GSNuWmvnkMR5kiESVESkb2ya/k@lists.infradead.org X-Gm-Message-State: AOJu0Yz+g2SijmFONfMC8TAes9FFKB9g3rMSH7jagBEm1BMVEErz+dbt E0eMWts2RTGNfb7JYwbQPn4XUkNBoz8rIve/5wE26ersMRtoy+q5GwWOOjxf4ND6I0Sdf+ZyvmR R X-Google-Smtp-Source: AGHT+IHrsSXMDzPW+YC1yMSEObvTKIKA03QKkD9vhWlsmxjtI4DSdraFVWhJ0pwmrnCg1VCCTAW2Bw== X-Received: by 2002:a2e:e0a:0:b0:2f0:1c7d:1ee2 with SMTP id 38308e7fff4ca-2f3aa1f99e7mr10852261fa.41.1723628402703; Wed, 14 Aug 2024 02:40:02 -0700 (PDT) Received: from krzk-bin.. ([178.197.215.209]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429ded28cdasm14195615e9.16.2024.08.14.02.40.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 02:40:01 -0700 (PDT) From: Krzysztof Kozlowski To: Patrice Chotard , Thinh Nguyen , Greg Kroah-Hartman , Felipe Balbi , Peter Griffin , Giuseppe Cavallaro , Lee Jones , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH 2/2] usb: dwc3: st: add missing depopulate in probe error path Date: Wed, 14 Aug 2024 11:39:57 +0200 Message-ID: <20240814093957.37940-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240814093957.37940-1-krzysztof.kozlowski@linaro.org> References: <20240814093957.37940-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-20240814_024004_984133_8ACA5E5D X-CRM114-Status: GOOD ( 13.85 ) 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: f83fca0707c6 ("usb: dwc3: add ST dwc3 glue layer to manage dwc3 HC") Cc: Signed-off-by: Krzysztof Kozlowski Reviewed-by: Patrice Chotard Acked-by: Thinh Nguyen --- Context of my other cleanup patches (separate series to be sent soon) will depend on this. --- drivers/usb/dwc3/dwc3-st.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-st.c b/drivers/usb/dwc3/dwc3-st.c index a9cb04043f08..c8c7cd0c1796 100644 --- a/drivers/usb/dwc3/dwc3-st.c +++ b/drivers/usb/dwc3/dwc3-st.c @@ -266,7 +266,7 @@ static int st_dwc3_probe(struct platform_device *pdev) if (!child_pdev) { dev_err(dev, "failed to find dwc3 core device\n"); ret = -ENODEV; - goto err_node_put; + goto depopulate; } dwc3_data->dr_mode = usb_get_dr_mode(&child_pdev->dev); @@ -282,6 +282,7 @@ static int st_dwc3_probe(struct platform_device *pdev) ret = st_dwc3_drd_init(dwc3_data); if (ret) { dev_err(dev, "drd initialisation failed\n"); + of_platform_depopulate(dev); goto undo_softreset; } @@ -291,6 +292,8 @@ static int st_dwc3_probe(struct platform_device *pdev) platform_set_drvdata(pdev, dwc3_data); return 0; +depopulate: + of_platform_depopulate(dev); err_node_put: of_node_put(child); undo_softreset: