summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/devices/dmi_memory.c27
-rw-r--r--modules/devices/spd-decode.c13
2 files changed, 16 insertions, 24 deletions
diff --git a/modules/devices/dmi_memory.c b/modules/devices/dmi_memory.c
index 8a95abf0..df6e33a9 100644
--- a/modules/devices/dmi_memory.c
+++ b/modules/devices/dmi_memory.c
@@ -75,12 +75,12 @@ dmi_mem_size dmi_read_memory_str_to_MiB(const char *memstr) {
else if (SEQ(l, "MB")) ret = v;
else if (SEQ(l, "kB")) {
/* should never appear */
- if (v % 1024) dmi_spd_msg("OMG kB!");
+ if (v % 1024) { dmi_spd_msg("OMG kB!"); }
ret = v / 1024;
}
else if (SEQ(l, "bytes")) {
/* should never appear */
- if (v % 1024) dmi_spd_msg("OMG bytes!");
+ if (v % 1024) { dmi_spd_msg("OMG bytes!"); }
ret = v / (1024 * 1024);
}
}
@@ -250,7 +250,7 @@ dmi_mem_socket *dmi_mem_socket_new(dmi_handle h) {
if (SEQ(s->type, "DRDRAM")) s->ram_type = DIRECT_RAMBUS;
if (SEQ(s->type, "RDRAM")) s->ram_type = RAMBUS;
if (s->ram_type)
- dmi_ram_types |= (1 << s->ram_type-1);
+ dmi_ram_types |= (1 << (s->ram_type-1));
s->type_detail = dmidecode_match("Type Detail", &dtm, &h);
STR_IGNORE(s->type_detail, "None");
@@ -393,7 +393,7 @@ dmi_mem *dmi_mem_new() {
dmi_handle_list *hla = dmidecode_handles(&dta);
if (hla) {
- int i = 0;
+ unsigned int i = 0;
for(i = 0; i < hla->count; i++) {
dmi_handle h = hla->handles[i];
m->arrays = g_slist_append(m->arrays, dmi_mem_array_new(h));
@@ -403,7 +403,7 @@ dmi_mem *dmi_mem_new() {
dmi_handle_list *hlm = dmidecode_handles(&dtm);
if (hlm) {
- int i = 0;
+ unsigned int i = 0;
for(i = 0; i < hlm->count; i++) {
dmi_handle h = hlm->handles[i];
m->sockets = g_slist_append(m->sockets, dmi_mem_socket_new(h));
@@ -425,7 +425,7 @@ dmi_mem *dmi_mem_new() {
spd_data *e = (spd_data*)l2->data;
m->spd_size_MiB += e->size_MiB;
if (e->type)
- m->spd_ram_types |= (1 << e->type-1);
+ m->spd_ram_types |= (1 << (e->type-1));
}
m->unique_short_locators = TRUE;
@@ -434,7 +434,6 @@ dmi_mem *dmi_mem_new() {
/* check for duplicate short_locator */
if (m->unique_short_locators) {
- gboolean has_duplicate = FALSE;
for(l2 = l->next; l2; l2 = l2->next) {
dmi_mem_socket *d = (dmi_mem_socket*)l2->data;
if (SEQ(s->short_locator, d->short_locator)) {
@@ -451,7 +450,7 @@ dmi_mem *dmi_mem_new() {
if (s->populated)
a->devs_populated++;
if (s->ram_type)
- a->ram_types |= (1 << s->ram_type-1);
+ a->ram_types |= (1 << (s->ram_type-1));
}
}
@@ -461,7 +460,6 @@ dmi_mem *dmi_mem_new() {
int loops = g_slist_length(sock_queue) * 4;
while(sock_queue) {
if (loops-- <= 0) break; /* something is wrong, give up */
- dmi_spd_msg("match queue has %d\n", g_slist_length(sock_queue) );
spd_data *best = NULL;
int best_score = 0;
dmi_mem_socket *s = (dmi_mem_socket*)sock_queue->data;
@@ -472,17 +470,14 @@ dmi_mem *dmi_mem_new() {
for(l2 = m->spd; l2; l2 = l2->next) {
spd_data *e = (spd_data*)l2->data;
int score = dmi_spd_match_score(s, e);
- dmi_spd_msg("... s:%s vs e:%s%s = %d (best_score = %d)\n", s->full_locator, e->dev, e->dmi_socket ? "*" : "", score, best_score);
if (score > best_score) {
if (score > e->match_score) {
- dmi_spd_msg("----- new best!\n");
best = e;
best_score = score;
}
}
}
if (best) {
- dmi_spd_msg("*** best for s:%s was e:%s with %d\n", s->full_locator, best->dev, best_score);
if (best->dmi_socket) {
/* displace */
dmi_mem_socket *old_sock = best->dmi_socket;
@@ -493,17 +488,13 @@ dmi_mem *dmi_mem_new() {
best->match_score = best_score;
s->spd = best;
} else {
- dmi_spd_msg("*** no conflict!\n");
best->dmi_socket = s;
best->match_score = best_score;
s->spd = best;
}
- } else
- dmi_spd_msg("no match!\n");
+ }
}
- dmi_spd_msg("------- done matching.\n");
-
/* fill any missing data in DMI that is
* provided by the matched SPD */
for(l = m->sockets; l; l = l->next) {
@@ -975,7 +966,7 @@ gboolean memory_devices_hinote(const char **msg) {
gboolean best_state = FALSE;
if (has_dmi && has_root &&
((has_eeprom && !spd_ddr4_partial_data)
- || has_ee1004 && !ddr3_ee1004) )
+ || (has_ee1004 && !ddr3_ee1004) ) )
best_state = TRUE;
if (!best_state) {
diff --git a/modules/devices/spd-decode.c b/modules/devices/spd-decode.c
index b0834481..1bebaa14 100644
--- a/modules/devices/spd-decode.c
+++ b/modules/devices/spd-decode.c
@@ -65,7 +65,7 @@ static const char *ram_types[] = {"Unknown", "Direct Rambus", "Rambus",
struct dmi_mem_socket;
typedef struct {
unsigned char bytes[512];
- unsigned char dev[32]; /* %1d-%04d\0 */
+ char dev[32]; /* %1d-%04d\0 */
int spd_driver; /* 0 = eeprom, 1 = ee1004 */
int spd_size;
@@ -256,6 +256,7 @@ static void decode_sdr_module_refresh_rate(unsigned char *bytes, char **refresh_
}
static void decode_sdr_module_detail(unsigned char *bytes, char *type_detail) {
+ bytes = bytes; /* silence unused warning */
if (type_detail) {
snprintf(type_detail, 255, "SDR");
}
@@ -657,7 +658,6 @@ static void decode_module_manufacturer(unsigned char *bytes, char **manufacturer
unsigned char first;
int ai = 0;
int len = 8;
- unsigned char *initial = bytes;
if (!spd_written(bytes, 8)) {
out = "Undefined";
@@ -886,7 +886,6 @@ static void decode_ddr4_module_detail(unsigned char *bytes, char *type_detail) {
static gchar *decode_ddr4_sdram_extra(unsigned char *bytes, int spd_size) {
float ddr_clock;
int pc4_speed, xmp_majv = -1, xmp_minv = -1;
- const char *dram_manf;
char *speed_timings = NULL, *xmp_profile = NULL, *xmp = NULL, *manf_date = NULL;
static gchar *out;
@@ -1021,7 +1020,7 @@ static GSList *decode_dimms2(GSList *eeprom_list, gboolean use_sysfs, int max_si
RamType ram_type;
- memset(bytes, 0, 512);
+ memset(bytes, 0, 512); /* clear */
spd_size = read_spd(spd_path, 0, max_size, use_sysfs, bytes);
ram_type = decode_ram_type(bytes);
@@ -1078,6 +1077,8 @@ static GSList *decode_dimms2(GSList *eeprom_list, gboolean use_sysfs, int max_si
s->ddr4_no_ee1004 = s->ddr4_no_ee1004 || (spd_size < 512);
spd_ddr4_partial_data = spd_ddr4_partial_data || s->ddr4_no_ee1004;
break;
+ case UNKNOWN:
+ break;
default:
DEBUG("Unsupported EEPROM type: %s for %s\n", GET_RAM_TYPE_STR(ram_type), spd_path); continue;
if (ram_type) {
@@ -1093,7 +1094,7 @@ static GSList *decode_dimms2(GSList *eeprom_list, gboolean use_sysfs, int max_si
s->spd_driver = 1;
s->spd_size = spd_size;
s->type = ram_type;
- spd_ram_types |= (1 << ram_type-1);
+ spd_ram_types |= (1 << (ram_type-1));
switch (ram_type) {
case SDR_SDRAM:
case DDR_SDRAM:
@@ -1132,7 +1133,7 @@ static const struct SpdDriver spd_drivers[] = {
GSList *spd_scan() {
GDir *dir = NULL;
GSList *eeprom_list = NULL, *dimm_list = NULL;
- gchar *dimm_list_entry, *dir_entry, *list = NULL;
+ gchar *dimm_list_entry, *dir_entry;
const struct SpdDriver *driver;
gboolean driver_found = FALSE;