[PATCH 1/2] Cochran: Small cleanup

John Van Ostrand john at vanostrand.com
Sun Jul 2 19:05:11 PDT 2017


Changed var to unsigned int.
Removed unused code.
---
 src/cochran_commander.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/src/cochran_commander.c b/src/cochran_commander.c
index ac4c596..ef9c5e4 100644
--- a/src/cochran_commander.c
+++ b/src/cochran_commander.c
@@ -553,7 +553,7 @@ cochran_commander_find_fingerprint(cochran_commander_device_t *device, cochran_d
 	data->invalid_profile_dive_num = -1;
 
 	// Remove the pre-dive events that occur after the last dive
-	int rb_head_ptr;
+	unsigned int rb_head_ptr;
 	if (device->layout->endian == ENDIAN_WORD_BE)
 		rb_head_ptr = (array_uint32_word_be(data->config + device->layout->cf_last_log) & 0xfffff000) + 0x2000;
 	else
@@ -931,20 +931,6 @@ cochran_commander_device_foreach (dc_device_t *abstract, dc_dive_callback_t call
 
 	device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo);
 
-	// Calculate profile RB effective head pointer
-	// Cochran seems to erase 8K chunks so round up.
-	unsigned int last_start_address;
-	if (layout->endian == ENDIAN_WORD_BE)
-		last_start_address = (array_uint32_word_be(data.config + layout->cf_last_interdive) & 0xfffff000) + 0x2000;
-	else
-		last_start_address = (array_uint32_le(data.config + layout->cf_last_interdive) & 0xfffff000) + 0x2000;
-
-	if (last_start_address < layout->rb_profile_begin || last_start_address > layout->rb_profile_end) {
-		ERROR(abstract->context, "Invalid profile ringbuffer head pointer in Cochran config block.");
-		status = DC_STATUS_DATAFORMAT;
-		goto error;
-	}
-
 	unsigned int head_dive = 0, tail_dive = 0, dive_count = 0;
 
 	if (data.dive_count <= rb_logbook_entry_count) {
-- 
2.4.11



More information about the devel mailing list