Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

zram: use IS_ERR_VALUE() to check for zs_malloc() errors

Avoid typecasts that are needed for IS_ERR() and use IS_ERR_VALUE()
instead.

Link: https://lkml.kernel.org/r/20221109115047.2921851-8-senozhatsky@chromium.org
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Alexey Romanov <avromanov@sberdevices.ru>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Suleiman Souhlal <suleiman@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Sergey Senozhatsky and committed by
Andrew Morton
f24ee92c 9fda785d

+3 -3
+3 -3
drivers/block/zram/zram_drv.c
··· 1542 1542 * if we have a 'non-null' handle here then we are coming 1543 1543 * from the slow path and handle has already been allocated. 1544 1544 */ 1545 - if (IS_ERR((void *)handle)) 1545 + if (IS_ERR_VALUE(handle)) 1546 1546 handle = zs_malloc(zram->mem_pool, comp_len, 1547 1547 __GFP_KSWAPD_RECLAIM | 1548 1548 __GFP_NOWARN | 1549 1549 __GFP_HIGHMEM | 1550 1550 __GFP_MOVABLE); 1551 - if (IS_ERR((void *)handle)) { 1551 + if (IS_ERR_VALUE(handle)) { 1552 1552 zcomp_stream_put(zram->comps[ZRAM_PRIMARY_COMP]); 1553 1553 atomic64_inc(&zram->stats.writestall); 1554 1554 handle = zs_malloc(zram->mem_pool, comp_len, 1555 1555 GFP_NOIO | __GFP_HIGHMEM | 1556 1556 __GFP_MOVABLE); 1557 - if (IS_ERR((void *)handle)) 1557 + if (IS_ERR_VALUE(handle)) 1558 1558 return PTR_ERR((void *)handle); 1559 1559 1560 1560 if (comp_len != PAGE_SIZE)