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>

authored by Thomas Renninger and committed by Dave Airlie 1783e4bf fafcf94e

+5 -3
+5 -3
drivers/gpu/drm/radeon/radeon_pm.c
··· 365 else if (strncmp("high", buf, strlen("high")) == 0) 366 rdev->pm.profile = PM_PROFILE_HIGH; 367 else { 368 - DRM_ERROR("invalid power profile!\n"); 369 goto fail; 370 } 371 radeon_pm_update_profile(rdev); 372 radeon_pm_set_clocks(rdev); 373 - } 374 fail: 375 mutex_unlock(&rdev->pm.mutex); 376 ··· 415 mutex_unlock(&rdev->pm.mutex); 416 cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work); 417 } else { 418 - DRM_ERROR("invalid power method!\n"); 419 goto fail; 420 } 421 radeon_pm_compute_clocks(rdev);
··· 365 else if (strncmp("high", buf, strlen("high")) == 0) 366 rdev->pm.profile = PM_PROFILE_HIGH; 367 else { 368 + count = -EINVAL; 369 goto fail; 370 } 371 radeon_pm_update_profile(rdev); 372 radeon_pm_set_clocks(rdev); 373 + } else 374 + count = -EINVAL; 375 + 376 fail: 377 mutex_unlock(&rdev->pm.mutex); 378 ··· 413 mutex_unlock(&rdev->pm.mutex); 414 cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work); 415 } else { 416 + count = -EINVAL; 417 goto fail; 418 } 419 radeon_pm_compute_clocks(rdev);