All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/vc4: hdmi: Unregister codec device on unbind
@ 2022-01-27 11:14 Maxime Ripard
  2022-02-03 15:06 ` (subset) " Maxime Ripard
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Maxime Ripard @ 2022-01-27 11:14 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst,
	Thomas Zimmermann, Maxime Ripard
  Cc: Tim Gover, Dom Cobley, Phil Elwell, dri-devel, Dave Stevenson

On bind we will register the HDMI codec device but we don't unregister
it on unbind, leading to a device leakage. Unregister our device at
unbind.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 8 ++++++++
 drivers/gpu/drm/vc4/vc4_hdmi.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 502d5bea5f61..395a9e9c1e5a 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1746,6 +1746,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi)
 		dev_err(dev, "Couldn't register the HDMI codec: %ld\n", PTR_ERR(codec_pdev));
 		return PTR_ERR(codec_pdev);
 	}
+	vc4_hdmi->audio.codec_pdev = codec_pdev;
 
 	dai_link->cpus		= &vc4_hdmi->audio.cpu;
 	dai_link->codecs	= &vc4_hdmi->audio.codec;
@@ -1785,6 +1786,12 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi)
 
 }
 
+static void vc4_hdmi_audio_exit(struct vc4_hdmi *vc4_hdmi)
+{
+	platform_device_unregister(vc4_hdmi->audio.codec_pdev);
+	vc4_hdmi->audio.codec_pdev = NULL;
+}
+
 static irqreturn_t vc4_hdmi_hpd_irq_thread(int irq, void *priv)
 {
 	struct vc4_hdmi *vc4_hdmi = priv;
@@ -2689,6 +2696,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master,
 	kfree(vc4_hdmi->hdmi_regset.regs);
 	kfree(vc4_hdmi->hd_regset.regs);
 
+	vc4_hdmi_audio_exit(vc4_hdmi);
 	vc4_hdmi_cec_exit(vc4_hdmi);
 	vc4_hdmi_hotplug_exit(vc4_hdmi);
 	vc4_hdmi_connector_destroy(&vc4_hdmi->connector);
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h
index db53500a8435..275c4674d50f 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.h
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
@@ -113,6 +113,7 @@ struct vc4_hdmi_audio {
 	struct snd_soc_dai_link_component platform;
 	struct snd_dmaengine_dai_dma_data dma_data;
 	struct hdmi_audio_infoframe infoframe;
+	struct platform_device *codec_pdev;
 	bool streaming;
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: (subset) [PATCH] drm/vc4: hdmi: Unregister codec device on unbind
  2022-01-27 11:14 [PATCH] drm/vc4: hdmi: Unregister codec device on unbind Maxime Ripard
@ 2022-02-03 15:06 ` Maxime Ripard
  2022-02-03 15:08   ` Maxime Ripard
  2022-02-17 16:08 ` Javier Martinez Canillas
  2022-02-17 16:34 ` (subset) " Maxime Ripard
  2 siblings, 1 reply; 5+ messages in thread
From: Maxime Ripard @ 2022-02-03 15:06 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann
  Cc: dri-devel, Dom Cobley, Phil Elwell, Tim Gover, Dave Stevenson

On Thu, 27 Jan 2022 12:14:52 +0100, Maxime Ripard wrote:
> On bind we will register the HDMI codec device but we don't unregister
> it on unbind, leading to a device leakage. Unregister our device at
> unbind.
> 
> 

Applied to drm/drm-misc (drm-misc-fixes).

Thanks!
Maxime

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: (subset) [PATCH] drm/vc4: hdmi: Unregister codec device on unbind
  2022-02-03 15:06 ` (subset) " Maxime Ripard
@ 2022-02-03 15:08   ` Maxime Ripard
  0 siblings, 0 replies; 5+ messages in thread
From: Maxime Ripard @ 2022-02-03 15:08 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Maarten Lankhorst, Thomas Zimmermann
  Cc: dri-devel, Dom Cobley, Phil Elwell, Tim Gover, Dave Stevenson

[-- Attachment #1: Type: text/plain, Size: 419 bytes --]

On Thu, Feb 03, 2022 at 04:06:37PM +0100, Maxime Ripard wrote:
> On Thu, 27 Jan 2022 12:14:52 +0100, Maxime Ripard wrote:
> > On bind we will register the HDMI codec device but we don't unregister
> > it on unbind, leading to a device leakage. Unregister our device at
> > unbind.
> > 
> > 
> 
> Applied to drm/drm-misc (drm-misc-fixes).

This one hasn't been reviewed yet, so I dropped it for now

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/vc4: hdmi: Unregister codec device on unbind
  2022-01-27 11:14 [PATCH] drm/vc4: hdmi: Unregister codec device on unbind Maxime Ripard
  2022-02-03 15:06 ` (subset) " Maxime Ripard
@ 2022-02-17 16:08 ` Javier Martinez Canillas
  2022-02-17 16:34 ` (subset) " Maxime Ripard
  2 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2022-02-17 16:08 UTC (permalink / raw)
  To: Maxime Ripard, Daniel Vetter, David Airlie, Maarten Lankhorst,
	Thomas Zimmermann
  Cc: dri-devel, Dave Stevenson, Dom Cobley, Tim Gover, Phil Elwell

Hello Maxime,

On 1/27/22 12:14, Maxime Ripard wrote:
> On bind we will register the HDMI codec device but we don't unregister
> it on unbind, leading to a device leakage. Unregister our device at
> unbind.
> 
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---

Patch looks good to me.

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Best regards,
-- 
Javier Martinez Canillas
Linux Engineering
Red Hat


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: (subset) [PATCH] drm/vc4: hdmi: Unregister codec device on unbind
  2022-01-27 11:14 [PATCH] drm/vc4: hdmi: Unregister codec device on unbind Maxime Ripard
  2022-02-03 15:06 ` (subset) " Maxime Ripard
  2022-02-17 16:08 ` Javier Martinez Canillas
@ 2022-02-17 16:34 ` Maxime Ripard
  2 siblings, 0 replies; 5+ messages in thread
From: Maxime Ripard @ 2022-02-17 16:34 UTC (permalink / raw)
  To: Daniel Vetter, Thomas Zimmermann, Maarten Lankhorst,
	Maxime Ripard, David Airlie
  Cc: dri-devel, Dom Cobley, Phil Elwell, Tim Gover, Dave Stevenson

On Thu, 27 Jan 2022 12:14:52 +0100, Maxime Ripard wrote:
> On bind we will register the HDMI codec device but we don't unregister
> it on unbind, leading to a device leakage. Unregister our device at
> unbind.
> 
> 

Applied to drm/drm-misc (drm-misc-fixes).

Thanks!
Maxime

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-17 16:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 11:14 [PATCH] drm/vc4: hdmi: Unregister codec device on unbind Maxime Ripard
2022-02-03 15:06 ` (subset) " Maxime Ripard
2022-02-03 15:08   ` Maxime Ripard
2022-02-17 16:08 ` Javier Martinez Canillas
2022-02-17 16:34 ` (subset) " Maxime Ripard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.