From c08f99c39083ab55a9c93b3e93cef48711294dad Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 10 Jun 2019 16:57:38 +0300 Subject: [PATCH 1/3] drm/bridge: tfp410: fix memleak in get_modes() We don't free the edid blob allocated by the call to drm_get_edid(), causing a memleak. Fix this by calling kfree(edid) at the end of the get_modes(). Signed-off-by: Tomi Valkeinen Signed-off-by: Andrzej Hajda Link: https://patchwork.freedesktop.org/patch/msgid/20190610135739.6077-1-tomi.valkeinen@ti.com --- drivers/gpu/drm/bridge/ti-tfp410.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index 8b0e71bd3ca7..9f0836cc712b 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -70,7 +70,12 @@ static int tfp410_get_modes(struct drm_connector *connector) drm_connector_update_edid_property(connector, edid); - return drm_add_edid_modes(connector, edid); + ret = drm_add_edid_modes(connector, edid); + + kfree(edid); + + return ret; + fallback: /* No EDID, fallback on the XGA standard modes */ ret = drm_add_modes_noedid(connector, 1920, 1200); From b1622cb3be4557fd086831ca7426eafe5f1acc2e Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Mon, 10 Jun 2019 16:57:39 +0300 Subject: [PATCH 2/3] drm/bridge: tfp410: fix use of cancel_delayed_work_sync We use delayed_work in HPD handling, and cancel any scheduled work in tfp410_fini using cancel_delayed_work_sync(). However, we have only initialized the delayed work if we actually have a HPD interrupt configured in the DT, but in the tfp410_fini, we always cancel the work, possibly causing a WARN(). Fix this by doing the cancel only if we actually had the delayed work set up. Signed-off-by: Tomi Valkeinen Signed-off-by: Andrzej Hajda Link: https://patchwork.freedesktop.org/patch/msgid/20190610135739.6077-2-tomi.valkeinen@ti.com --- drivers/gpu/drm/bridge/ti-tfp410.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index 9f0836cc712b..07b695172db2 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -381,7 +381,8 @@ static int tfp410_fini(struct device *dev) { struct tfp410 *dvi = dev_get_drvdata(dev); - cancel_delayed_work_sync(&dvi->hpd_work); + if (dvi->hpd_irq >= 0) + cancel_delayed_work_sync(&dvi->hpd_work); drm_bridge_remove(&dvi->bridge); From 6116b892bd4fd0ddc5f30566a556218bb2e1a9b6 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Mon, 24 Jun 2019 11:21:53 +0200 Subject: [PATCH 3/3] vga_switcheroo: Depend upon fbcon being built-in, if enabled Fixes linking fail when fbcon/fbdev is modular and vgaswitcheroo is enabled: x86_64-linux-gnu-ld: drivers/gpu/vga/vga_switcheroo.o: in function `vga_switchto_stage2': vga_switcheroo.c:(.text+0x997): undefined reference to `fbcon_remap_all' Unfortunately this means that in a default allmodconfig we will disable vgaswitcheroo. v2: I first tried to fix this with an EXPORT_SYMBOL, but vga_switcheroo is never a module, so this doesn't work. Reported-by: Stephen Rothwell Reported-by: kbuild test robot Fixes: 1cd51b5d200d ("vgaswitcheroo: call fbcon_remap_all directly") Signed-off-by: Daniel Vetter Cc: Stephen Rothwell Cc: Lukas Wunner Cc: Daniel Vetter Cc: Sam Ravnborg Cc: Maarten Lankhorst Cc: David Airlie Cc: Daniel Vetter Cc: Maxime Ripard Cc: Sean Paul Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Yisheng Xie Cc: linux-fbdev@vger.kernel.org Cc: Daniel Thompson Cc: Lee Jones Cc: dri-devel@lists.freedesktop.org Cc: linux-fbdev@vger.kernel.org Signed-off-by: Maarten Lankhorst Link: https://patchwork.freedesktop.org/patch/msgid/20190624092153.23375-1-daniel.vetter@ffwll.ch --- drivers/gpu/vga/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/vga/Kconfig b/drivers/gpu/vga/Kconfig index 84ab482d0db6..c8c770b05ed9 100644 --- a/drivers/gpu/vga/Kconfig +++ b/drivers/gpu/vga/Kconfig @@ -23,6 +23,7 @@ config VGA_SWITCHEROO depends on X86 depends on ACPI depends on PCI + depends on (FRAMEBUFFER_CONSOLE=n || FB=y) select VGA_ARB help Many laptops released in 2008/9/10 have two GPUs with a multiplexer