summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2020-02-07 23:02:59 -0700
committerGitHub <noreply@github.com>2020-02-07 23:02:59 -0700
commita152612a36408f4160c2ff1d50eb069c2ac4b9a9 (patch)
tree1fd82dee0044ae61e652d58e10a033f0ed848a6a /libs
parentdc017c1150ae3bb7ac4b5bb1ef9d00e116d349ca (diff)
downloadbcm5719-ortega-a152612a36408f4160c2ff1d50eb069c2ac4b9a9.tar.gz
bcm5719-ortega-a152612a36408f4160c2ff1d50eb069c2ac4b9a9.zip
build: Enable clang-analyzer (scan-build) (#24)
Diffstat (limited to 'libs')
-rw-r--r--libs/NVRam/bitbang.c16
-rw-r--r--libs/VPD/vpd.c4
2 files changed, 12 insertions, 8 deletions
diff --git a/libs/NVRam/bitbang.c b/libs/NVRam/bitbang.c
index 0e8e67d..af99155 100644
--- a/libs/NVRam/bitbang.c
+++ b/libs/NVRam/bitbang.c
@@ -122,6 +122,7 @@ bool NVRam_sendBytes(uint8_t bytes[], uint32_t num_bytes)
nvm_od.bits.SIOutputDisable = 0; // Drive MOSI
RegNVMWrite_t nvm_write;
+ nvm_write.r32 = 0;
NVM.Addr.r32 = nvm_od.r32;
NVM.Write.r32 = nvm_write.r32;
@@ -167,6 +168,7 @@ bool NVRam_sendAndGetBytes(uint8_t send_bytes[], uint8_t get_bytes[], int32_t nu
nvm_od.bits.SIOutputDisable = 0; // Drive MOSI
RegNVMWrite_t nvm_write;
+ nvm_write.r32 = 0;
NVM.Addr.r32 = nvm_od.r32;
NVM.Write.r32 = nvm_write.r32;
@@ -196,11 +198,17 @@ uint32_t NVRam_bitbang_readWord(uint32_t address)
};
uint8_t get_bytes[sizeof(send_bytes)];
uint32_t num_bytes = sizeof(send_bytes);
- NVRam_sendAndGetBytes(send_bytes, get_bytes, num_bytes);
-
- uint32_t read_word = (get_bytes[4]) | (get_bytes[5] << 8) | (get_bytes[6] << 16) | (get_bytes[7] << 24);
+ if(NVRam_sendAndGetBytes(send_bytes, get_bytes, num_bytes))
+ {
+ uint32_t read_word = (get_bytes[4]) | (get_bytes[5] << 8) | (get_bytes[6] << 16) | (get_bytes[7] << 24);
- return read_word;
+ return read_word;
+ }
+ else
+ {
+ // TOOD: return an error.
+ return 0;
+ }
}
void NVRam_bitbang_writeWord(uint32_t address, uint32_t word)
diff --git a/libs/VPD/vpd.c b/libs/VPD/vpd.c
index c37c909..f0cf704 100644
--- a/libs/VPD/vpd.c
+++ b/libs/VPD/vpd.c
@@ -150,10 +150,6 @@ uint8_t *vpd_get_resource_by_index(uint8_t *buffer, uint32_t *len, uint16_t *nam
{
field = (vpd_field_t *)new_buf;
- char *data = (char *)malloc(field->length + 1);
- memcpy(data, &field->data, field->length);
- data[field->length] = 0;
-
new_buf += field->length;
new_buf += 3;
OpenPOWER on IntegriCloud