From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BA963074B7; Wed, 17 Sep 2025 12:45:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758113156; cv=none; b=VDEB0GawvBN4LSpaHo2P6Avt3fabtT9F14sRBrZZHAX1UXwB5J28ZnDm0z7P5DNMNO1CiV3kySxK9RhJEXd8Umtpe4FGvwWrEn43LwuIrt+4hveeTpimQIftUka+sasEIpqVDdVh9rh9yzs/z3ETdSzgROCWYQ+CuruuoWpllEc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758113156; c=relaxed/simple; bh=MSukoovXzAyFirFVJc3pbcNA6NmzBNOJxUaMbQRT6Ck=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t9u1/W5luYcrZOuueZuxqcZEMhTG13LkER3IgghJulkBFGQDQXnreKdgGZzPfzH54T1bJI14LefLnxSyktun9FgWi7UNZs5hvVK8ybQ29fLei3Vcp2DmQOyNH3LOhybe8wM165miMRIebq21WfLqHki3aIIi54sevrRZhB5ieeo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=y22sxYtV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="y22sxYtV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB469C4CEF0; Wed, 17 Sep 2025 12:45:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1758113156; bh=MSukoovXzAyFirFVJc3pbcNA6NmzBNOJxUaMbQRT6Ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y22sxYtVck9i2W4w98alOX4I1HWHl3aSymUt+WPcRYBeoMoy5AF9vKby7zL6a5UMz ihjhlGFNlVfjRs9MxLdNr8TiughiH8/3fdqRbzXvts0EMH3kKiZJK0J+XlMCb4bK+7 jXX7Uq8eHqG8z7Fj3Jk9tdtgMPyUIqdQnYwHp6Co= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Roger Quadros , Johan Hovold , Vinod Koul Subject: [PATCH 6.16 188/189] phy: ti: omap-usb2: fix device leak at unbind Date: Wed, 17 Sep 2025 14:34:58 +0200 Message-ID: <20250917123356.486108242@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250917123351.839989757@linuxfoundation.org> References: <20250917123351.839989757@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 64961557efa1b98f375c0579779e7eeda1a02c42 upstream. Make sure to drop the reference to the control device taken by of_find_device_by_node() during probe when the driver is unbound. Fixes: 478b6c7436c2 ("usb: phy: omap-usb2: Don't use omap_get_control_dev()") Cc: stable@vger.kernel.org # 3.13 Cc: Roger Quadros Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20250724131206.2211-3-johan@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/phy/ti/phy-omap-usb2.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/drivers/phy/ti/phy-omap-usb2.c +++ b/drivers/phy/ti/phy-omap-usb2.c @@ -363,6 +363,13 @@ static void omap_usb2_init_errata(struct phy->flags |= OMAP_USB2_DISABLE_CHRG_DET; } +static void omap_usb2_put_device(void *_dev) +{ + struct device *dev = _dev; + + put_device(dev); +} + static int omap_usb2_probe(struct platform_device *pdev) { struct omap_usb *phy; @@ -373,6 +380,7 @@ static int omap_usb2_probe(struct platfo struct device_node *control_node; struct platform_device *control_pdev; const struct usb_phy_data *phy_data; + int ret; phy_data = device_get_match_data(&pdev->dev); if (!phy_data) @@ -423,6 +431,11 @@ static int omap_usb2_probe(struct platfo return -EINVAL; } phy->control_dev = &control_pdev->dev; + + ret = devm_add_action_or_reset(&pdev->dev, omap_usb2_put_device, + phy->control_dev); + if (ret) + return ret; } else { if (of_property_read_u32_index(node, "syscon-phy-power", 1,