public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen.5i5j@gmail.com>
To: David Vrabel <david.vrabel@citrix.com>,
	konrad.wilk@oracle.com, boris.ostrovsky@oracle.com,
	stefano.stabellini@eu.citrix.com, mukesh.rathor@oracle.com
Cc: xen-devel@lists.xenproject.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/3 v2] xen/xenbus: Improve failure processing code for __xenbus_switch_state()
Date: Thu, 18 Sep 2014 22:01:40 +0800	[thread overview]
Message-ID: <541AE5C4.2070409@gmail.com> (raw)
In-Reply-To: <541AE4E9.2040904@gmail.com>

When failure occurs, need return failure code instead of 0, or some of
indirect upper callers may misunderstand.

e.g. in "block/xen-blkback/xenbus.c":

    connect() -> xenbus_switch_state() -> __xenbus_switch_state().

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 drivers/xen/xenbus/xenbus_client.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
index ca74410..642a476 100644
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -36,6 +36,7 @@
 #include <linux/spinlock.h>
 #include <linux/vmalloc.h>
 #include <linux/export.h>
+#include <linux/delay.h>
 #include <asm/xen/hypervisor.h>
 #include <asm/xen/page.h>
 #include <xen/interface/xen.h>
@@ -196,7 +197,7 @@ again:
 	err = xenbus_transaction_start(&xbt);
 	if (err) {
 		xenbus_switch_fatal(dev, depth, err, "starting transaction");
-		return 0;
+		return err;
 	}
 
 	err = xenbus_scanf(xbt, dev->nodename, "state", "%d", &current_state);
@@ -219,7 +220,7 @@ abort:
 	} else
 		dev->state = state;
 
-	return 0;
+	return err;
 }
 
 /**
-- 
1.9.3

  parent reply	other threads:[~2014-09-18 14:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18 13:58 [PATCH 0/3 v2] xen/xenbus: Several improvements for 'xenbus_client.c' Chen Gang
2014-09-18 13:59 ` [PATCH 1/3 v2] xen/xenbus: Correct the comments for xenbus_grant_ring() Chen Gang
2014-09-18 14:00 ` [PATCH 2/3 v2] xen/xenbus: Remove BUG_ON() when error string trucated Chen Gang
2014-09-18 14:01 ` Chen Gang [this message]
2014-09-22 15:04   ` [Xen-devel] [PATCH 3/3 v2] xen/xenbus: Improve failure processing code for __xenbus_switch_state() David Vrabel
2014-09-22 15:51     ` Chen Gang
2014-09-22 16:01       ` David Vrabel
2014-09-23  1:56         ` Chen Gang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=541AE5C4.2070409@gmail.com \
    --to=gang.chen.5i5j@gmail.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mukesh.rathor@oracle.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox