FAILED: patch "[PATCH] drm/imx/tve: fix probe device leak" failed to apply to 5.10-stable tree
Subsystems (5)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x e535c23513c63f02f67e3e09e0787907029efeaf
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026020324-unsure-backfield-4511@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e535c23513c63f02f67e3e09e0787907029efeaf Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Thu, 30 Oct 2025 17:34:56 +0100
Subject: [PATCH] drm/imx/tve: fix probe device leak
Make sure to drop the reference taken to the DDC device during probe on probe failure (e.g. probe deferral) and on driver unbind.
drivers/gpu/drm/imx/ipuv3/imx-tve.c +13 -0
@@ -528,6 +528,13 @@ static const struct component_ops imx_tve_ops = { .bind = imx_tve_bind, }; +static void imx_tve_put_device (void *_dev) +{ +struct device *dev = _dev; + +put_device (dev); +} +static int imx_tve_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -549,6 +556,12 @@ static int imx_tve_probe(struct platform_device *pdev)if (ddc_node) { tve->ddc =of_find_i2c_adapter_by_node (ddc_node);of_node_put (ddc_node); +if (tve->ddc) { + ret =devm_add_action_or_reset (dev, imx_tve_put_device, + &tve->ddc->dev); +if (ret) +return ret; + } } tve->mode =of_get_tve_mode (np);
Sasha Levin
maintainerPATCH 1/3 drm/imx: imx-tve: use local encoder and connector variables
From: Philipp Zabel <[email protected]>
[ Upstream commit 396852df02b9ff49fe256ba459605fc680fe8d89 ]
Introduce local variables for encoder and connector. This simplifies the following commits.
Stable-dep-of: e535c23513c6 ("drm/imx/tve: fix probe device leak")
--- drivers/gpu/drm/imx/imx-tve.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/imx/imx-tve.c +8 -7
@@ -431,27 +431,28 @@ static int tve_clk_init(struct imx_tve *tve, void __iomem *base)static int imx_tve_register (struct drm_device *drm,struct imx_tve *tve) { +struct drm_encoder *encoder = &tve->encoder; +struct drm_connector *connector = &tve->connector;int encoder_type;int ret; encoder_type = tve->mode ==TVE_MODE_VGA ?DRM_MODE_ENCODER_DAC :DRM_MODE_ENCODER_TVDAC ; - ret =imx_drm_encoder_parse_of (drm, &tve->encoder, tve->dev->of_node); + ret =imx_drm_encoder_parse_of (drm, encoder, tve->dev->of_node);if (ret)return ret; -drm_encoder_helper_add (&tve->encoder, &imx_tve_encoder_helper_funcs); -drm_simple_encoder_init (drm, &tve->encoder, encoder_type); +drm_encoder_helper_add (encoder, &imx_tve_encoder_helper_funcs); +drm_simple_encoder_init (drm, encoder, encoder_type); -drm_connector_helper_add (&tve->connector, - &imx_tve_connector_helper_funcs); -drm_connector_init_with_ddc (drm, &tve->connector, +drm_connector_helper_add (connector, &imx_tve_connector_helper_funcs); +drm_connector_init_with_ddc (drm, connector, &imx_tve_connector_funcs,DRM_MODE_CONNECTOR_VGA , tve->ddc); -drm_connector_attach_encoder (&tve->connector, &tve->encoder); +drm_connector_attach_encoder (connector, encoder);return 0 ; }
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 2/3 drm/imx: imx-tve: move initialization into probe
From: Philipp Zabel <[email protected]>
[ Upstream commit a91cfaf6e6503150ed1ef08454f2c03e1f95a4ec ]
Parts of the initialization that do not require the drm device can be done once during probe instead of possibly multiple times during bind. The bind function only creates the encoder.
Stable-dep-of: e535c23513c6 ("drm/imx/tve: fix probe device leak")
--- drivers/gpu/drm/imx/imx-tve.c | 42 ++++++++++++++++------------------- 1 file changed, 19 insertions(+), 23 deletions(-)
drivers/gpu/drm/imx/imx-tve.c +19 -23
@@ -439,6 +439,9 @@ static int imx_tve_register(struct drm_device *drm, struct imx_tve *tve) encoder_type = tve->mode ==TVE_MODE_VGA ?DRM_MODE_ENCODER_DAC :DRM_MODE_ENCODER_TVDAC ; +memset (connector,0 ,sizeof (*connector)); +memset (encoder,0 ,sizeof (*encoder)); + ret =imx_drm_encoder_parse_of (drm, encoder, tve->dev->of_node);if (ret)return ret;
@@ -504,8 +507,19 @@ static int of_get_tve_mode(struct device_node *np)static int imx_tve_bind (struct device *dev,struct device *master,void *data) { -struct platform_device *pdev =to_platform_device (dev);struct drm_device *drm = data; +struct imx_tve *tve =dev_get_drvdata (dev); + +return imx_tve_register (drm, tve); +} + +static const struct component_ops imx_tve_ops = { + .bind = imx_tve_bind, +}; + +static int imx_tve_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev;struct device_node *np = dev->of_node;struct device_node *ddc_node;struct imx_tve *tve;
@@ -515,8 +529,9 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)int irq;int ret; - tve =dev_get_drvdata (dev); -memset (tve,0 ,sizeof (*tve)); + tve =devm_kzalloc (dev,sizeof (*tve),GFP_KERNEL ); +if (!tve) +return -ENOMEM ; tve->dev = dev;
@@ -623,28 +638,9 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)if (ret)return ret; - ret =imx_tve_register (drm, tve); -if (ret) -return ret; - -return 0 ; -} - -static const struct component_ops imx_tve_ops = { - .bind = imx_tve_bind, -}; - -static int imx_tve_probe (struct platform_device *pdev) -{ -struct imx_tve *tve; - - tve =devm_kzalloc (&pdev->dev,sizeof (*tve),GFP_KERNEL ); -if (!tve) -return -ENOMEM ; -platform_set_drvdata (pdev, tve); -return component_add (&pdev->dev, &imx_tve_ops); +return component_add (dev, &imx_tve_ops); }static int imx_tve_remove (struct platform_device *pdev)
Signature · 1 line
2.51.0
Sasha Levin
maintainerPATCH 3/3 drm/imx/tve: fix probe device leak
In reply to Sasha LevinFrom: Johan Hovold <[email protected]>
[ Upstream commit e535c23513c63f02f67e3e09e0787907029efeaf ]
Make sure to drop the reference taken to the DDC device during probe on probe failure (e.g. probe deferral) and on driver unbind.
--- drivers/gpu/drm/imx/imx-tve.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/gpu/drm/imx/imx-tve.c +13 -0
@@ -517,6 +517,13 @@ static const struct component_ops imx_tve_ops = { .bind = imx_tve_bind, }; +static void imx_tve_put_device (void *_dev) +{ +struct device *dev = _dev; + +put_device (dev); +} +static int imx_tve_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -539,6 +546,12 @@ static int imx_tve_probe(struct platform_device *pdev)if (ddc_node) { tve->ddc =of_find_i2c_adapter_by_node (ddc_node);of_node_put (ddc_node); +if (tve->ddc) { + ret =devm_add_action_or_reset (dev, imx_tve_put_device, + &tve->ddc->dev); +if (ret) +return ret; + } } tve->mode =of_get_tve_mode (np);
Signature · 1 line
2.51.0