linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Time: Clocksource: fix 'ret' data type of sysfs_override_clocksource() and sysfs_unbind_clocksource()
@ 2013-09-12 10:28 elad.wexler
  2013-09-16 18:30 ` John Stultz
  0 siblings, 1 reply; 2+ messages in thread
From: elad.wexler @ 2013-09-12 10:28 UTC (permalink / raw)
  To: john.stultz, tglx; +Cc: linux-kernel, Elad Wexler

From: Elad Wexler <elad.wexler@gmail.com>

sysfs_override_clocksource(): The expression 'if (ret >= 0)' is always true.
This will cause clocksource_select() to always run.
Thus modified ret to be of type ssize_t.

sysfs_unbind_clocksource(): The expression 'if (ret < 0)' is always false.
So in case sysfs_get_uname() failed, the expression won't take an effect.
Thus modified ret to be of type ssize_t.

Signed-off-by: Elad Wexler <elad.wexler@gmail.com>
---
 kernel/time/clocksource.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 50a8736..6d28a52 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -924,7 +924,7 @@ static ssize_t sysfs_override_clocksource(struct device *dev,
 					  struct device_attribute *attr,
 					  const char *buf, size_t count)
 {
-	size_t ret;
+	ssize_t ret;
 
 	mutex_lock(&clocksource_mutex);
 
@@ -952,7 +952,7 @@ static ssize_t sysfs_unbind_clocksource(struct device *dev,
 {
 	struct clocksource *cs;
 	char name[CS_NAME_LEN];
-	size_t ret;
+	ssize_t ret;
 
 	ret = sysfs_get_uname(buf, name, count);
 	if (ret < 0)
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Time: Clocksource: fix 'ret' data type of sysfs_override_clocksource() and sysfs_unbind_clocksource()
  2013-09-12 10:28 [PATCH] Time: Clocksource: fix 'ret' data type of sysfs_override_clocksource() and sysfs_unbind_clocksource() elad.wexler
@ 2013-09-16 18:30 ` John Stultz
  0 siblings, 0 replies; 2+ messages in thread
From: John Stultz @ 2013-09-16 18:30 UTC (permalink / raw)
  To: elad.wexler; +Cc: tglx, linux-kernel

On 09/12/2013 03:28 AM, elad.wexler@gmail.com wrote:
> From: Elad Wexler <elad.wexler@gmail.com>
>
> sysfs_override_clocksource(): The expression 'if (ret >= 0)' is always true.
> This will cause clocksource_select() to always run.
> Thus modified ret to be of type ssize_t.
>
> sysfs_unbind_clocksource(): The expression 'if (ret < 0)' is always false.
> So in case sysfs_get_uname() failed, the expression won't take an effect.
> Thus modified ret to be of type ssize_t.
>
> Signed-off-by: Elad Wexler <elad.wexler@gmail.com>

Queued for 3.13.

thanks
-john


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-16 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-12 10:28 [PATCH] Time: Clocksource: fix 'ret' data type of sysfs_override_clocksource() and sysfs_unbind_clocksource() elad.wexler
2013-09-16 18:30 ` John Stultz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).