From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx144.postini.com [74.125.245.144]) by kanga.kvack.org (Postfix) with SMTP id 43DAB6B0039 for ; Wed, 6 Mar 2013 03:53:01 -0500 (EST) Received: by mail-pb0-f41.google.com with SMTP id um15so5726066pbc.0 for ; Wed, 06 Mar 2013 00:53:00 -0800 (PST) From: Bob Liu Subject: [PATCH V2 09/11] zcache/tmem: Better error checking on frontswap_register_ops return value. Date: Wed, 6 Mar 2013 16:51:28 +0800 Message-Id: <1362559890-16710-9-git-send-email-lliubbo@gmail.com> In-Reply-To: <1362559890-16710-1-git-send-email-lliubbo@gmail.com> References: <1362559890-16710-1-git-send-email-lliubbo@gmail.com> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: dan.magenheimer@oracle.com, konrad.wilk@oracle.com, sjenning@linux.vnet.ibm.com, gregkh@linuxfoundation.org, akpm@linux-foundation.org, rcj@linux.vnet.ibm.com, ngupta@vflare.org, minchan@kernel.org, ric.masonn@gmail.com, Bob Liu From: Konrad Rzeszutek Wilk 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 Signed-off-by: Bob Liu --- drivers/staging/zcache/zcache-main.c | 5 ++++- drivers/xen/tmem.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 3554987..48e46c5 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -2006,8 +2006,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, diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index 9a4a9ec..2f939e5 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c @@ -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\n"); } -- 1.7.10.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org