diff options
author | Xiongwei Song <sxwjean@gmail.com> | 2018-01-05 07:34:36 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-01-08 16:37:18 +0100 |
commit | fb02205a18ac65aaccdce371ad2039c1edbde9a7 (patch) | |
tree | f951cb9d8987ee9828fd9f89274c8581fe995db3 /drivers/staging/android | |
parent | 47ac54e877c386653070c7a6f57aa12a45ce80e1 (diff) | |
download | linux-stable-fb02205a18ac65aaccdce371ad2039c1edbde9a7.tar.gz linux-stable-fb02205a18ac65aaccdce371ad2039c1edbde9a7.tar.bz2 linux-stable-fb02205a18ac65aaccdce371ad2039c1edbde9a7.zip |
staging: android: check the return value of register_shrinker
register_shrinker call is made in ashmem_init, it may return error code,
so we need to check it.
Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/android')
-rw-r--r-- | drivers/staging/android/ashmem.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 425c49f9330c..8b52ca2af864 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -873,12 +873,18 @@ static int __init ashmem_init(void) goto out_free2; } - register_shrinker(&ashmem_shrinker); + ret = register_shrinker(&ashmem_shrinker); + if (ret) { + pr_err("failed to register shrinker!\n"); + goto out_demisc; + } pr_info("initialized\n"); return 0; +out_demisc: + misc_deregister(&ashmem_misc); out_free2: kmem_cache_destroy(ashmem_range_cachep); out_free1: |