From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Airlie <airlied@linux.ie>, Rex Zhu <Rex.Zhu@amd.com>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
"Jammy Zhou" <Jammy.Zhou@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Sonny Jiang" <sonny.jiang@amd.com>,
dri-devel@lists.freedesktop.org, kernel-janitors@vger.kernel.org
Subject: [patch] drm/amdgpu: double unlock in amdgpu_set_dpm_forced_performance_level()
Date: Mon, 04 Jan 2016 20:42:01 +0000 [thread overview]
Message-ID: <20160104204201.GA19867@mwanda> (raw)
We recently moved the locking around and accidentally introduced a
double unlock bug.
Fixes: 1b5708ffb103 ('drm/amdgpu: export amd_powerplay_func to amdgpu and other ip block')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 3b78982..872e586 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -147,8 +147,7 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
} else if (strncmp("auto", buf, strlen("auto")) = 0) {
level = AMDGPU_DPM_FORCED_LEVEL_AUTO;
} else {
- count = -EINVAL;
- goto fail;
+ return -EINVAL;
}
if (adev->pp_enabled)
@@ -157,18 +156,18 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
mutex_lock(&adev->pm.mutex);
if (adev->pm.dpm.thermal_active) {
count = -EINVAL;
- goto fail;
+ goto unlock;
}
ret = amdgpu_dpm_force_performance_level(adev, level);
- if (ret)
+ if (ret) {
count = -EINVAL;
- else
- adev->pm.dpm.forced_level = level;
+ goto unlock;
+ }
+ adev->pm.dpm.forced_level = level;
+
+unlock:
mutex_unlock(&adev->pm.mutex);
}
-fail:
- mutex_unlock(&adev->pm.mutex);
-
return count;
}
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: David Airlie <airlied@linux.ie>, Rex Zhu <Rex.Zhu@amd.com>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
"Jammy Zhou" <Jammy.Zhou@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Sonny Jiang" <sonny.jiang@amd.com>,
dri-devel@lists.freedesktop.org, kernel-janitors@vger.kernel.org
Subject: [patch] drm/amdgpu: double unlock in amdgpu_set_dpm_forced_performance_level()
Date: Mon, 4 Jan 2016 23:42:01 +0300 [thread overview]
Message-ID: <20160104204201.GA19867@mwanda> (raw)
We recently moved the locking around and accidentally introduced a
double unlock bug.
Fixes: 1b5708ffb103 ('drm/amdgpu: export amd_powerplay_func to amdgpu and other ip block')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 3b78982..872e586 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -147,8 +147,7 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
} else if (strncmp("auto", buf, strlen("auto")) == 0) {
level = AMDGPU_DPM_FORCED_LEVEL_AUTO;
} else {
- count = -EINVAL;
- goto fail;
+ return -EINVAL;
}
if (adev->pp_enabled)
@@ -157,18 +156,18 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
mutex_lock(&adev->pm.mutex);
if (adev->pm.dpm.thermal_active) {
count = -EINVAL;
- goto fail;
+ goto unlock;
}
ret = amdgpu_dpm_force_performance_level(adev, level);
- if (ret)
+ if (ret) {
count = -EINVAL;
- else
- adev->pm.dpm.forced_level = level;
+ goto unlock;
+ }
+ adev->pm.dpm.forced_level = level;
+
+unlock:
mutex_unlock(&adev->pm.mutex);
}
-fail:
- mutex_unlock(&adev->pm.mutex);
-
return count;
}
next reply other threads:[~2016-01-04 20:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-04 20:42 Dan Carpenter [this message]
2016-01-04 20:42 ` [patch] drm/amdgpu: double unlock in amdgpu_set_dpm_forced_performance_level() Dan Carpenter
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=20160104204201.GA19867@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Jammy.Zhou@amd.com \
--cc=Rex.Zhu@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=sonny.jiang@amd.com \
/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.