summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 49d05d5)
raw | patch | inline | side by side (parent: 49d05d5)
author | Tahhan, Maryam <maryam.tahhan@intel.com> | |
Fri, 14 Apr 2017 11:41:00 +0000 (12:41 +0100) | ||
committer | Tahhan, Maryam <maryam.tahhan@intel.com> | |
Wed, 3 May 2017 13:20:15 +0000 (14:20 +0100) |
* Comparing variables with NULL explicilty instead of !var
* Removed unnecessary casts
Change-Id: I50a1691c42842c81ff71c2e91a8fb292524dc945
Signed-off-by: Tahhan, Maryam <maryam.tahhan@intel.com>
* Removed unnecessary casts
Change-Id: I50a1691c42842c81ff71c2e91a8fb292524dc945
Signed-off-by: Tahhan, Maryam <maryam.tahhan@intel.com>
src/mcelog.c | patch | blob | history |
diff --git a/src/mcelog.c b/src/mcelog.c
index 928db1cb6d5cd7546dd3e34e51195ba91e1eaeea..4f3f9b0cf4c0c22dcd7dca6bdbe3c1aff9555b1f 100644 (file)
--- a/src/mcelog.c
+++ b/src/mcelog.c
llentry_t *dimm_le = mcelog_get_dimm(dimm_name, dimms_list);
if (dimm_le == NULL) {
- mcelog_memory_rec_t *dimm_mr =
- (mcelog_memory_rec_t *)calloc(1, sizeof(mcelog_memory_rec_t));
- if (!dimm_mr) {
+ mcelog_memory_rec_t *dimm_mr = calloc(1, sizeof(*dimm_mr));
+ if (dimm_mr == NULL) {
ERROR(MCELOG_PLUGIN ": Error allocating dimm memory item");
return NULL;
}
dimm_le = llentry_create(p_name, dimm_mr);
if (dimm_le == NULL) {
ERROR(MCELOG_PLUGIN ": llentry_create(): error");
+ free(dimm_mr);
return NULL;
}
pthread_mutex_lock(&g_mcelog_config.dimms_lock);
return (-1);
llentry_t *dimm = mcelog_dimm(mr, g_mcelog_config.dimms_list);
- if (!dimm) {
+ if (dimm == NULL) {
ERROR(MCELOG_PLUGIN ": Error adding/getting dimm memory item to/from cache");
return -1;
}
- mcelog_memory_rec_t *mr_old = (mcelog_memory_rec_t *)dimm->value;
+ mcelog_memory_rec_t *mr_old = dimm->value;
if (mr_old->corrected_err_total != mr->corrected_err_total ||
mr_old->corrected_err_timed != mr->corrected_err_timed)
}
llentry_t *dimm = mcelog_dimm(mr, g_mcelog_config.dimms_list);
- if (!dimm) {
+ if (dimm == NULL) {
ERROR(MCELOG_PLUGIN ": Error adding/getting dimm memory item to/from cache");
return -1;
}