All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: dri-devel@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH v2 04/15] drm/radeon: Don't leak runtime pm ref on driver load
Date: Wed, 8 Jun 2016 18:47:27 +0200	[thread overview]
Message-ID: <fa5bb977c1fe00474acedae5b03232dbf0b49410.1465392124.git.lukas@wunner.de> (raw)
In-Reply-To: <cover.1465392124.git.lukas@wunner.de>

radeon_device_init() returns an error if either of the two calls to
radeon_init() fail. One level up in the call stack,
radeon_driver_load_kms() will then skip runtime pm initialization and
call radeon_driver_unload_kms(), which acquires a runtime pm ref that
is leaked.

Balance by releasing a runtime pm ref in the error path of
radeon_device_init().

Fixes: 10ebc0bc0934 ("drm/radeon: add runtime PM support (v2)")
Cc: Dave Airlie <airlied@redhat.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/gpu/drm/radeon/radeon_device.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index e721e6b..e0bf778 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -30,6 +30,7 @@
 #include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/radeon_drm.h>
+#include <linux/pm_runtime.h>
 #include <linux/vgaarb.h>
 #include <linux/vga_switcheroo.h>
 #include <linux/efi.h>
@@ -1505,6 +1506,9 @@ int radeon_device_init(struct radeon_device *rdev,
 	return 0;
 
 failed:
+	/* balance pm_runtime_get_sync() in radeon_driver_unload_kms() */
+	if (radeon_is_px(ddev))
+		pm_runtime_put_noidle(ddev->dev);
 	if (runtime)
 		vga_switcheroo_fini_domain_pm_ops(rdev->dev);
 	return r;
-- 
2.8.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-06-08 16:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 16:47 [PATCH v2 00/15] Runtime pm ref leak bonanza Lukas Wunner
2016-06-08 16:47 ` [PATCH v2 09/15] drm: Add helpers to turn off CRTCs Lukas Wunner
     [not found] ` <cover.1465392124.git.lukas-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-06-08 16:47   ` [PATCH v2 02/15] drm/nouveau: Forbid runtime pm on driver unload Lukas Wunner
2016-06-08 16:47   ` [PATCH v2 15/15] drm/nouveau/dispnv04: Use helper to turn off CRTC Lukas Wunner
2016-06-08 16:47   ` [PATCH v2 10/15] drm/nouveau: Turn off CRTCs on driver unload Lukas Wunner
2016-06-09  6:50   ` [PATCH v2 00/15] Runtime pm ref leak bonanza Daniel Vetter
     [not found]     ` <20160609065032.GI3363-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2016-06-09  7:20       ` Ben Skeggs
2016-06-14 20:18       ` Alex Deucher
     [not found]         ` <CADnq5_NENZukwJg-CACQ-djWsP4e299gnr4aWrEJkdcVMeaZWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-15 11:37           ` Lukas Wunner
     [not found]             ` <20160615113735.GA562-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-06-15 15:11               ` Daniel Vetter
     [not found]                 ` <20160615151154.GF1338-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2016-06-22 12:44                   ` Lukas Wunner
     [not found]                     ` <20160622124447.GA3267-JFq808J9C/izQB+pC5nmwQ@public.gmane.org>
2016-06-22 12:43                       ` Daniel Vetter
2016-06-08 16:47 ` [PATCH v2 14/15] drm/i2c/ch7006: Use helper to turn off CRTC Lukas Wunner
2016-06-11 21:57   ` Francisco Jerez
2016-06-08 16:47 ` [PATCH v2 08/15] drm/amdgpu: Forbid runtime pm on driver unload Lukas Wunner
2016-06-08 16:47 ` [PATCH v2 07/15] drm/amdgpu: Don't leak runtime pm ref on driver load Lukas Wunner
2016-06-08 16:47 ` [PATCH v2 03/15] drm/radeon: Don't leak runtime pm ref on driver unload Lukas Wunner
2016-06-08 16:47 ` Lukas Wunner [this message]
2016-06-08 16:47 ` [PATCH v2 05/15] drm/radeon: Forbid runtime pm " Lukas Wunner
2016-06-08 16:47 ` [PATCH v2 11/15] drm/radeon: Turn off CRTCs " Lukas Wunner
2016-06-08 16:47 ` [PATCH v2 13/15] drm: Use helper to turn off CRTC Lukas Wunner
2016-06-08 16:47 ` [PATCH v2 01/15] drm/nouveau: Don't leak runtime pm ref on driver unload Lukas Wunner
2016-06-08 16:47 ` [PATCH v2 12/15] drm/amdgpu: Turn off CRTCs " Lukas Wunner
2016-06-08 16:47 ` [PATCH v2 06/15] drm/amdgpu: Don't leak runtime pm ref " Lukas Wunner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fa5bb977c1fe00474acedae5b03232dbf0b49410.1465392124.git.lukas@wunner.de \
    --to=lukas@wunner.de \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.