lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 07 Mar 2013 16:41:18 +0530
From:	anish kumar <anish198519851985@...il.com>
To:	john.stultz@...aro.org, tglx@...utronix.de
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] [Timer][Trivial] __clocksource_register_scale return value
 use?

__clocksource_register_scale() currently returns int but it should
return void as there are no error paths in that function.
Making it void would help some amount of code to be removed at various
places.

clocksource_register_hz/khz() return value is checked
in most of the places but I think it will translate to always
if(true) so let's remove those checks as well(patch will be sent
later for that).

Is this return value for some future usecase(?), if yes then my
apologies.

Signed-off-by: anish kumar <anish198519851985@...il.com>
---
 include/linux/clocksource.h |    6 +++---
 kernel/time/clocksource.c   |    7 +------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 27cfda4..2b074cc 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -294,17 +294,17 @@ clocks_calc_mult_shift(u32 *mult, u32 *shift, u32
from, u32 to, u32 minsec);
  * Don't call __clocksource_register_scale directly, use
  * clocksource_register_hz/khz
  */
-extern int
+extern void
 __clocksource_register_scale(struct clocksource *cs, u32 scale, u32
freq);
 extern void
 __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32
freq);
 
-static inline int clocksource_register_hz(struct clocksource *cs, u32
hz)
+static inline void clocksource_register_hz(struct clocksource *cs, u32
hz)
 {
 	return __clocksource_register_scale(cs, 1, hz);
 }
 
-static inline int clocksource_register_khz(struct clocksource *cs, u32
khz)
+static inline void clocksource_register_khz(struct clocksource *cs, u32
khz)
 {
 	return __clocksource_register_scale(cs, 1000, khz);
 }
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index c958338..1915550 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -703,14 +703,11 @@ EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale);
  * @scale:	Scale factor multiplied against freq to get clocksource hz
  * @freq:	clocksource frequency (cycles per second) divided by scale
  *
- * Returns -EBUSY if registration fails, zero otherwise.
- *
  * This *SHOULD NOT* be called directly! Please use the
  * clocksource_register_hz() or clocksource_register_khz helper
functions.
  */
-int __clocksource_register_scale(struct clocksource *cs, u32 scale, u32
freq)
+void __clocksource_register_scale(struct clocksource *cs, u32 scale,
u32 freq)
 {
-
 	/* Initialize mult/shift and max_idle_ns */
 	__clocksource_updatefreq_scale(cs, scale, freq);
 
@@ -720,11 +717,9 @@ int __clocksource_register_scale(struct clocksource
*cs, u32 scale, u32 freq)
 	clocksource_enqueue_watchdog(cs);
 	clocksource_select();
 	mutex_unlock(&clocksource_mutex);
-	return 0;
 }
 EXPORT_SYMBOL_GPL(__clocksource_register_scale);
 
-
 /**
  * clocksource_register - Used to install new clocksources
  * @cs:		clocksource to be registered
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ