Skip to contentSkip to conversation

s390: oprofile: fix error checks in oprofile_hwsampler_init()

PATCH Superseded Nicolas Kaiser 1 participant 1 message Mar 31, 2011 s390

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390: oprofile: fix error checks in oprofile_hwsampler_init()

Checking 'oprofile_min_interval < 0' and 'oprofile_max_interval < 0' doesn't work because 'oprofile_min_interval' and 'oprofile_max_interval' are unsigned.

---
Untested.

 arch/s390/oprofile/init.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
arch/s390/oprofile/init.c +8 -4
index c63d7e5..09c3088 100644
@@ -138,22 +138,26 @@ static int oprofile_create_hwsampling_files(struct super_block *sb,
 
 static int oprofile_hwsampler_init(struct oprofile_operations *ops)
 {
+	long retval;
+
 	if (hwsampler_setup())
 		return -ENODEV;
 
 	/*
 	 * create hwsampler files only if hwsampler_setup() succeeds.
 	 */
-	oprofile_min_interval = hwsampler_query_min_interval();
-	if (oprofile_min_interval < 0) {
+	retval = hwsampler_query_min_interval();
+	if (retval < 0) {
 		oprofile_min_interval = 0;
 		return -ENODEV;
 	}
-	oprofile_max_interval = hwsampler_query_max_interval();
-	if (oprofile_max_interval < 0) {
+	oprofile_min_interval = retval;
+	retval = hwsampler_query_max_interval();
+	if (retval < 0) {
 		oprofile_max_interval = 0;
 		return -ENODEV;
 	}
+	oprofile_max_interval = retval;
 
 	if (oprofile_timer_init(ops))
 		return -ENODEV;
Signature · 1 line
1.7.3.4