drm radeon: Return -EINVAL on wrong pm sysfs access
Subsystems (2)
PATCH 1/1 drm radeon: Return -EINVAL on wrong pm sysfs access
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
--- drivers/gpu/drm/radeon/radeon_pm.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_pm.c +5 -3
@@ -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);
Quoted 6 lines · Thomas Renninger
drm radeon: Return
-EINVALon wrong pm sysfs accessThrow an error if someone tries to fill this with
wrong data, instead of simply ignoring the input.
Now you get:
Quoted 6 lines
echo hello >/sys/../power_method
-bash: echo: write error: Invalid argument
Looks good to me.
Quoted 40 lines
---
drivers/gpu/drm/radeon/radeon_pm.c | 8 +++++---1 files changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/radeon/radeon_pm.c +4
-2@@ -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);drivers/gpu/drm/radeon/radeon_pm.c +1
-1@@ -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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
2011/3/23 Thomas Renninger <[email protected]>:
Quoted 22 lines
drm radeon: Return
-EINVALon wrong pm sysfs accessThrow 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---
drivers/gpu/drm/radeon/radeon_pm.c | 8 +++++---1 files changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/radeon/radeon_pm.c +0
-0
drivers/gpu/drm/radeon/radeon_pm.c static ssize_t radeon_set_pm_profile(struct device *dev, · line 368
Quoted 5 lines
drivers/gpu/drm/radeon/radeon_pm.c +1
-1@@ -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;
I think this does not match kernel coding style (braces).
Signature · 5 lines
Rafał _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 18 lines · W dniu 26 marca 2011 16:38 użytkownik Rafał Miłecki <[email protected]> napisał:
2011/3/23 Thomas Renninger <[email protected]>:
Quoted 17 lines
drm radeon: Return
-EINVALon wrong pm sysfs accessThrow 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---
drivers/gpu/drm/radeon/radeon_pm.c | 8 +++++---1 files changed, 5 insertions(+), 3 deletions(-)
Quoted 12 lines
drivers/gpu/drm/radeon/radeon_pm.c static ssize_t radeon_set_pm_profile(struct device *dev, · line 368
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_pm.c +1
-1@@ -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;I think this does not match kernel coding style (braces).
This is not 100% your fault of course, someone put this not proper style here earlier. Maybe just worth fixing by the way.
Signature · 5 lines
Rafał _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 18 lines · On Saturday 26 March 2011 16:38:22 Rafał Miłecki wrote:
2011/3/23 Thomas Renninger <[email protected]>:
Quoted 17 lines
drm radeon: Return
-EINVALon wrong pm sysfs accessThrow 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--- drivers/gpu/drm/radeon/radeon_pm.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
Quoted 12 lines
drivers/gpu/drm/radeon/radeon_pm.c static ssize_t radeon_set_pm_profile(struct device *dev, · line 368
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_pm.c +1
-1@@ -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 ;I think this does not match kernel coding style (braces).
Can you be more specific, please.
I can't see style issues, ./scripts/checkpatch.pl is also happy.
Thomas
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel