bootable/recovery: cleanup compiler warnings (unused value)

bootable/recovery/applypatch/imgdiff.cpp:322:11: warning: Value stored to 'ret' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
bootable/recovery/applypatch/imgdiff.cpp:447:11: warning: Value stored to 'ret' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
bootable/recovery/applypatch/imgdiff.cpp:553:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]

Bug: 26936282
Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mm
Change-Id: I3f865e3e9b9d19e5ea5e8dfd2fe2c644254ffbb5
diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp
index f6087de..77c19ad 100644
--- a/applypatch/imgdiff.cpp
+++ b/applypatch/imgdiff.cpp
@@ -320,6 +320,10 @@
       // -15 means we are decoding a 'raw' deflate stream; zlib will
       // not expect zlib headers.
       int ret = inflateInit2(&strm, -15);
+      if (ret < 0) {
+        printf("failed to initialize inflate: %d\n", ret);
+        return NULL;
+      }
 
       strm.avail_out = curr->len;
       strm.next_out = curr->data;
@@ -445,6 +449,10 @@
       // -15 means we are decoding a 'raw' deflate stream; zlib will
       // not expect zlib headers.
       int ret = inflateInit2(&strm, -15);
+      if (ret < 0) {
+        printf("failed to initialize inflate: %d\n", ret);
+        return NULL;
+      }
 
       do {
         strm.avail_out = allocated - curr->len;
@@ -552,10 +560,18 @@
   int ret;
   ret = deflateInit2(&strm, chunk->level, chunk->method, chunk->windowBits,
                      chunk->memLevel, chunk->strategy);
+  if (ret < 0) {
+    printf("failed to initialize deflate: %d\n", ret);
+    return -1;
+  }
   do {
     strm.avail_out = BUFFER_SIZE;
     strm.next_out = out;
     ret = deflate(&strm, Z_FINISH);
+    if (ret < 0) {
+      printf("failed to deflate: %d\n", ret);
+      return -1;
+    }
     size_t have = BUFFER_SIZE - strm.avail_out;
 
     if (memcmp(out, chunk->deflate_data+p, have) != 0) {