On Wed, Mar 23, 2011 at 11:14 AM, Thomas Renninger <trenn at suse.de> wrote:
> 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 at suse.de>
> CC: Alexander.Deucher at amd.com
> CC: dri-devel at lists.freedesktop.org

Looks good to me.

Reviewed-by: Alex Deucher <alexdeucher at gmail.com>

>
> ---
> ?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 2aed03b..08de669 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,
> ? ? ? ? ? ? ? ?else if (strncmp("high", buf, strlen("high")) == 0)
> ? ? ? ? ? ? ? ? ? ? ? ?rdev->pm.profile = PM_PROFILE_HIGH;
> ? ? ? ? ? ? ? ?else {
> - ? ? ? ? ? ? ? ? ? ? ? DRM_ERROR("invalid power profile!\n");
> + ? ? ? ? ? ? ? ? ? ? ? count = -EINVAL;
> ? ? ? ? ? ? ? ? ? ? ? ?goto fail;
> ? ? ? ? ? ? ? ?}
> ? ? ? ? ? ? ? ?radeon_pm_update_profile(rdev);
> ? ? ? ? ? ? ? ?radeon_pm_set_clocks(rdev);
> - ? ? ? }
> + ? ? ? } else
> + ? ? ? ? ? ? ? count = -EINVAL;
> +
> ?fail:
> ? ? ? ?mutex_unlock(&rdev->pm.mutex);
>
> @@ -413,7 +415,7 @@ static ssize_t radeon_set_pm_method(struct device *dev,
> ? ? ? ? ? ? ? ?mutex_unlock(&rdev->pm.mutex);
> ? ? ? ? ? ? ? ?cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
> ? ? ? ?} else {
> - ? ? ? ? ? ? ? DRM_ERROR("invalid power method!\n");
> + ? ? ? ? ? ? ? count = -EINVAL;
> ? ? ? ? ? ? ? ?goto fail;
> ? ? ? ?}
> ? ? ? ?radeon_pm_compute_clocks(rdev);
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

Reply via email to