summaryrefslogtreecommitdiff
path: root/cpuid.c
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2006-05-21 02:29:22 -0400
committerDave Jones <davej@redhat.com>2006-05-21 02:29:22 -0400
commitcac1bb76563ad7592f1cc3de6e78fb0acd9df440 (patch)
tree86265cc0da2244f31c42bfc78ac177f407cc213e /cpuid.c
parent9bf76afa26fe058e91c539930b2c2a5fc8b14086 (diff)
Lots of splint warning cleanups.
Diffstat (limited to 'cpuid.c')
-rw-r--r--cpuid.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/cpuid.c b/cpuid.c
index 70d4bcc..4c448d1 100644
--- a/cpuid.c
+++ b/cpuid.c
@@ -5,7 +5,7 @@
* Fixes by Arjan van de Ven (arjanv@redhat.com) and
* Philipp Rumpf (prumpf@mandrakesoft.com)
*
- * Licensed under the terms of the GNU GPL License version 2.
+ * Licensed under the terms of the GNU GPL License version 2.
*
*/
@@ -33,30 +33,34 @@ void cpuid (int CPU_number, unsigned int idx,
int fh;
if (nodriver==1) {
- cpuid_UP (idx, eax, ebx, ecx, edx);
+ cpuid_UP(idx, eax, ebx, ecx, edx);
return;
}
/* Ok, use the /dev/CPU interface in preference to the _up code. */
- snprintf (cpuname,18, "/dev/cpu/%d/cpuid", CPU_number);
- fh = open (cpuname, O_RDONLY);
+ (void)snprintf(cpuname,18, "/dev/cpu/%d/cpuid", CPU_number);
+ fh = open(cpuname, O_RDONLY);
if (fh != -1) {
- lseek64 (fh, (off64_t)idx, SEEK_CUR);
- if (read (fh, &buffer[0], 16) == -1) {
+#ifndef S_SPLINT_S
+ lseek64(fh, (off64_t)idx, SEEK_CUR);
+#endif
+ if (read(fh, &buffer[0], 16) == -1) {
perror(cpuname);
- exit(-1);
+ exit(EXIT_FAILURE);
}
if (eax!=0) *eax = (*(unsigned *)(buffer ));
if (ebx!=0) *ebx = (*(unsigned *)(buffer+ 4));
if (ecx!=0) *ecx = (*(unsigned *)(buffer+ 8));
if (edx!=0) *edx = (*(unsigned *)(buffer+12));
- close (fh);
+ if (close(fh) == -1) {
+ perror("close");
+ exit(EXIT_FAILURE);
+ }
} else {
/* Something went wrong, just do UP and hope for the best. */
nodriver = 1;
- if (!silent && nrCPUs != 1) {
+ if (!silent && nrCPUs != 1)
perror(cpuname);
- }
used_UP = 1;
cpuid_UP (idx, eax, ebx, ecx, edx);
return;