]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
zcache/tmem: Better error checking on frontswap_register_ops return value.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Sun, 10 Mar 2013 10:54:45 +0000 (21:54 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 12 Mar 2013 03:56:30 +0000 (14:56 +1100)
In the past it either used to be NULL or the "older" backend. Now we
also return -Exx error codes.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Andor Daam <andor.daam@googlemail.com>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Florian Schmaus <fschmaus@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Stefan Hengelein <ilendir@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/staging/zcache/zcache-main.c
drivers/xen/tmem.c

index 3b10c845182daeb5d40c264bfb3e46a0ad9a5eaf..e1d1e9d44dd1bfbe0d1abd63f218cf91a6b5692b 100644 (file)
@@ -1795,8 +1795,11 @@ static int __init zcache_init(void)
                        namestr, frontswap_has_exclusive_gets,
                        !disable_frontswap_ignore_nonactive);
 #endif
-               if (old_ops != NULL)
+               if (IS_ERR(old_ops) || old_ops) {
+                       if (IS_ERR(old_ops))
+                               return PTR_RET(old_ops);
                        pr_warn("%s: frontswap_ops overridden\n", namestr);
+               }
        }
        if (ramster_enabled)
                ramster_init(!disable_cleancache, !disable_frontswap,
index ba46717dc7076ad4cce9a7397dd9115b010c9f27..4f3ff99640abb3411c68e2b6bbfea15dc01cd0ff 100644 (file)
@@ -395,8 +395,11 @@ static int xen_tmem_init(void)
                        frontswap_register_ops(&tmem_frontswap_ops);
 
                tmem_frontswap_poolid = -1;
-               if (old_ops)
+               if (IS_ERR(old_ops) || old_ops) {
+                       if (IS_ERR(old_ops))
+                               return PTR_ERR(old_ops);
                        s = " (WARNING: frontswap_ops overridden)";
+               }
                printk(KERN_INFO "frontswap enabled, RAM provided by "
                                 "Xen Transcendent Memory%s\n", s);
        }