Hui Zhu c7e6f17b52 zsmalloc: zs_malloc: return ERR_PTR on failure
zs_malloc returns 0 if it fails.  zs_zpool_malloc will return -1 when
zs_malloc return 0.  But -1 makes the return value unclear.

For example, when zswap_frontswap_store calls zs_malloc through
zs_zpool_malloc, it will return -1 to its caller.  The other return value
is -EINVAL, -ENODEV or something else.

This commit changes zs_malloc to return ERR_PTR on failure.  It didn't
just let zs_zpool_malloc return -ENOMEM becaue zs_malloc has two types of
failure:

- size is not OK return -EINVAL
- memory alloc fail return -ENOMEM.

Link: https://lkml.kernel.org/r/20220714080757.12161-1-teawater@gmail.com
Signed-off-by: Hui Zhu <teawater@antgroup.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-07-29 18:07:15 -07:00
..
2022-06-03 11:48:47 -07:00
2022-06-26 14:12:56 -07:00
2022-05-15 18:31:28 -06:00
2022-06-03 11:48:47 -07:00
2022-07-17 17:14:30 -07:00
2022-05-29 11:38:27 -07:00
2022-06-20 08:38:29 -05:00
2022-06-26 14:12:56 -07:00
2022-06-24 17:01:31 -07:00
2022-07-17 17:14:28 -07:00
2022-05-26 21:08:40 -07:00
2022-06-07 15:00:29 -07:00
2022-06-02 15:23:54 -07:00
2022-07-17 17:14:30 -07:00
2022-06-02 15:23:54 -07:00
2022-05-25 15:02:26 +02:00
2022-06-03 11:48:47 -07:00
2022-06-02 15:23:54 -07:00
2022-05-23 21:06:11 -07:00
2022-05-19 16:56:17 +02:00
2022-06-12 11:33:42 -07:00
2022-06-03 11:48:47 -07:00
2022-06-02 15:23:54 -07:00
2022-06-03 11:48:47 -07:00
2022-06-03 11:48:47 -07:00
2022-05-11 08:29:11 +03:00
2022-06-01 13:49:15 -07:00
2022-06-05 09:25:12 -07:00
2022-06-05 09:25:12 -07:00