diff options
author | Hui Zhu <teawater@antgroup.com> | 2022-07-14 16:07:57 +0800 |
---|---|---|
committer | akpm <akpm@linux-foundation.org> | 2022-07-29 18:07:15 -0700 |
commit | c7e6f17b52e9486a9d997368819dfec032b550e2 (patch) | |
tree | 8a671ecdc4f7acb88558e20fd08e4a34f853484b /net/ipv6/raw.c | |
parent | fef3e9066d19230f661048ca86937d954c12cd50 (diff) | |
download | linux-c7e6f17b52e9486a9d997368819dfec032b550e2.tar.gz |
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>
Diffstat (limited to 'net/ipv6/raw.c')
0 files changed, 0 insertions, 0 deletions