From: Bob Liu Subject: [PATCH 11/14] tmem: fix the return value of tmemc_set_var() Date: Wed, 18 Dec 2013 14:52:38 +0800 Message-ID: <1387349561-27923-12-git-send-email-bob.liu@oracle.com> References: <1387349561-27923-1-git-send-email-bob.liu@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VtB3e-0007Ee-Dx for xen-devel@lists.xenproject.org; Wed, 18 Dec 2013 06:56:38 +0000 Received: by mail-pd0-f171.google.com with SMTP id z10so7798251pdj.16 for ; Tue, 17 Dec 2013 22:56:33 -0800 (PST) In-Reply-To: <1387349561-27923-1-git-send-email-bob.liu@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: james.harper@bendigoit.com.au, keir@xen.org, ian.campbell@citrix.com, andrew.cooper3@citrix.com, JBeulich@suse.com List-Id: xen-devel@lists.xenproject.org tmemc_set_var() calls tmemc_set_var_one() but without taking its return value, this patch fix this issue. Also rename tmemc_set_var_one() to __tmemc_set_var(). Signed-off-by: Bob Liu --- xen/common/tmem.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/xen/common/tmem.c b/xen/common/tmem.c index 72c3838..eea3cbb 100644 --- a/xen/common/tmem.c +++ b/xen/common/tmem.c @@ -2176,7 +2176,7 @@ static int tmemc_list(domid_t cli_id, tmem_cli_va_param_t buf, uint32_t len, return 0; } -static int tmemc_set_var_one(struct client *client, uint32_t subop, uint32_t arg1) +static int __tmemc_set_var(struct client *client, uint32_t subop, uint32_t arg1) { domid_t cli_id = client->cli_id; uint32_t old_weight; @@ -2218,15 +2218,24 @@ static int tmemc_set_var_one(struct client *client, uint32_t subop, uint32_t arg static int tmemc_set_var(domid_t cli_id, uint32_t subop, uint32_t arg1) { struct client *client; + int ret = -1; if ( cli_id == TMEM_CLI_ID_NULL ) + { list_for_each_entry(client,&global_client_list,client_list) - tmemc_set_var_one(client, subop, arg1); - else if ( (client = tmem_client_from_cli_id(cli_id)) == NULL) - return -1; + { + ret = __tmemc_set_var(client, subop, arg1); + if (ret) + break; + } + } else - tmemc_set_var_one(client, subop, arg1); - return 0; + { + client = tmem_client_from_cli_id(cli_id); + if ( client ) + ret = __tmemc_set_var(client, subop, arg1); + } + return ret; } static int tmemc_shared_pool_auth(domid_t cli_id, uint64_t uuid_lo, -- 1.7.10.4