]> 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>
Tue, 26 Mar 2013 23:24:20 +0000 (10:24 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Apr 2013 06:12:03 +0000 (17:12 +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 781d57c49ea644178b98f6d36b226686138eccef..6841fbab5f5a4a9c409690b2a26d96a392df2a5d 100644 (file)
@@ -1886,8 +1886,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 8adde8e8428c9b0534a038e164a8e0d9e3f5e2c2..e3600be4e7fabe54660d5adb1d2f7446b482ff00 100644 (file)
@@ -397,8 +397,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);
        }