Btrfs: correct error-handling zlib error handling

find_zlib_workspace returns an ERR_PTR value in an error case instead of NULL.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@match exists@
expression x, E;
statement S1, S2;
@@

x = find_zlib_workspace(...)
... when != x = E
(
* if (x == NULL || ...) S1 else S2
|
* if (x == NULL && ...) S1 else S2
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Chris Mason <chris.mason@oracle.com>

authored by Julia Lawall and committed by Chris Mason 60f2e8f8 4baf8c92

+3 -3
+3 -3
fs/btrfs/zlib.c
··· 208 *total_in = 0; 209 210 workspace = find_zlib_workspace(); 211 - if (!workspace) 212 return -1; 213 214 if (Z_OK != zlib_deflateInit(&workspace->def_strm, 3)) { ··· 366 char *kaddr; 367 368 workspace = find_zlib_workspace(); 369 - if (!workspace) 370 return -ENOMEM; 371 372 data_in = kmap(pages_in[page_in_index]); ··· 547 return -ENOMEM; 548 549 workspace = find_zlib_workspace(); 550 - if (!workspace) 551 return -ENOMEM; 552 553 workspace->inf_strm.next_in = data_in;
··· 208 *total_in = 0; 209 210 workspace = find_zlib_workspace(); 211 + if (IS_ERR(workspace)) 212 return -1; 213 214 if (Z_OK != zlib_deflateInit(&workspace->def_strm, 3)) { ··· 366 char *kaddr; 367 368 workspace = find_zlib_workspace(); 369 + if (IS_ERR(workspace)) 370 return -ENOMEM; 371 372 data_in = kmap(pages_in[page_in_index]); ··· 547 return -ENOMEM; 548 549 workspace = find_zlib_workspace(); 550 + if (IS_ERR(workspace)) 551 return -ENOMEM; 552 553 workspace->inf_strm.next_in = data_in;