mirror of
https://github.com/torvalds/linux.git
synced 2024-11-08 05:01:48 +00:00
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>
This commit is contained in:
parent
fafcf94e2b
commit
1783e4bf6f
@ -365,12 +365,14 @@ static ssize_t radeon_set_pm_profile(struct device *dev,
|
|||||||
else if (strncmp("high", buf, strlen("high")) == 0)
|
else if (strncmp("high", buf, strlen("high")) == 0)
|
||||||
rdev->pm.profile = PM_PROFILE_HIGH;
|
rdev->pm.profile = PM_PROFILE_HIGH;
|
||||||
else {
|
else {
|
||||||
DRM_ERROR("invalid power profile!\n");
|
count = -EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
radeon_pm_update_profile(rdev);
|
radeon_pm_update_profile(rdev);
|
||||||
radeon_pm_set_clocks(rdev);
|
radeon_pm_set_clocks(rdev);
|
||||||
}
|
} else
|
||||||
|
count = -EINVAL;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
mutex_unlock(&rdev->pm.mutex);
|
mutex_unlock(&rdev->pm.mutex);
|
||||||
|
|
||||||
@ -413,7 +415,7 @@ static ssize_t radeon_set_pm_method(struct device *dev,
|
|||||||
mutex_unlock(&rdev->pm.mutex);
|
mutex_unlock(&rdev->pm.mutex);
|
||||||
cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
|
cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
|
||||||
} else {
|
} else {
|
||||||
DRM_ERROR("invalid power method!\n");
|
count = -EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
radeon_pm_compute_clocks(rdev);
|
radeon_pm_compute_clocks(rdev);
|
||||||
|
Loading…
Reference in New Issue
Block a user