From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Liu Subject: [PATCH 11/14] tmem: fix the return value of tmemc_set_var() Date: Tue, 28 Jan 2014 12:28:30 +0800 Message-ID: <1390883313-19313-12-git-send-email-bob.liu@oracle.com> References: <1390883313-19313-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.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1W80Kx-0008Dr-As for xen-devel@lists.xenproject.org; Tue, 28 Jan 2014 04:31:47 +0000 Received: by mail-pb0-f47.google.com with SMTP id rp16so6764654pbb.34 for ; Mon, 27 Jan 2014 20:31:43 -0800 (PST) In-Reply-To: <1390883313-19313-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: 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