diff options
author | Thomas Renninger <trenn@suse.de> | 2011-03-23 11:14:09 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-03-24 06:24:49 -0400 |
commit | 1783e4bf6f4e5c3b13c09aff24da7dcc69fb3e2f (patch) | |
tree | 8847ef1145d3a766e15fc8d4b5918b09eed60196 /drivers/gpu | |
parent | fafcf94e2b5732d1e13b440291c53115d2b172e9 (diff) |
drm radeon: Return -EINVAL on wrong pm sysfs access
Throw an error if someone tries to fill this with
wrong data, instead of simply ignoring the input.
Now you get:
echo hello >/sys/../power_method
-bash: echo: write error: Invalid argument
Signed-off-by: Thomas Renninger <trenn@suse.de>
CC: Alexander.Deucher@amd.com
CC: dri-devel@lists.freedesktop.org
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_pm.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 2aed03bde4b2..08de669e025a 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -365,12 +365,14 @@ static ssize_t radeon_set_pm_profile(struct device *dev, | |||
365 | else if (strncmp("high", buf, strlen("high")) == 0) | 365 | else if (strncmp("high", buf, strlen("high")) == 0) |
366 | rdev->pm.profile = PM_PROFILE_HIGH; | 366 | rdev->pm.profile = PM_PROFILE_HIGH; |
367 | else { | 367 | else { |
368 | DRM_ERROR("invalid power profile!\n"); | 368 | count = -EINVAL; |
369 | goto fail; | 369 | goto fail; |
370 | } | 370 | } |
371 | radeon_pm_update_profile(rdev); | 371 | radeon_pm_update_profile(rdev); |
372 | radeon_pm_set_clocks(rdev); | 372 | radeon_pm_set_clocks(rdev); |
373 | } | 373 | } else |
374 | count = -EINVAL; | ||
375 | |||
374 | fail: | 376 | fail: |
375 | mutex_unlock(&rdev->pm.mutex); | 377 | mutex_unlock(&rdev->pm.mutex); |
376 | 378 | ||
@@ -413,7 +415,7 @@ static ssize_t radeon_set_pm_method(struct device *dev, | |||
413 | mutex_unlock(&rdev->pm.mutex); | 415 | mutex_unlock(&rdev->pm.mutex); |
414 | cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work); | 416 | cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work); |
415 | } else { | 417 | } else { |
416 | DRM_ERROR("invalid power method!\n"); | 418 | count = -EINVAL; |
417 | goto fail; | 419 | goto fail; |
418 | } | 420 | } |
419 | radeon_pm_compute_clocks(rdev); | 421 | radeon_pm_compute_clocks(rdev); |