Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Nov 2016 05:35:29 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r309128 - head/sys/dev/hyperv/vmbus
Message-ID:  <201611250535.uAP5ZTo4042898@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Fri Nov 25 05:35:29 2016
New Revision: 309128
URL: https://svnweb.freebsd.org/changeset/base/309128

Log:
  hyperv/vmbus: Commit the GPADL id only after the connection succeeds.
  
  Minor style change.
  
  MFC after:	1 week
  Sponsored by:	Microsoft
  Differential Revision:	https://reviews.freebsd.org/D8563

Modified:
  head/sys/dev/hyperv/vmbus/vmbus_chan.c

Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_chan.c	Fri Nov 25 04:35:40 2016	(r309127)
+++ head/sys/dev/hyperv/vmbus/vmbus_chan.c	Fri Nov 25 05:35:29 2016	(r309128)
@@ -453,7 +453,7 @@ vmbus_chan_open_br(struct vmbus_channel 
 
 failed:
 	vmbus_chan_clear_chmap(chan);
-	if (chan->ch_bufring_gpadl) {
+	if (chan->ch_bufring_gpadl != 0) {
 		vmbus_chan_gpadl_disconnect(chan, chan->ch_bufring_gpadl);
 		chan->ch_bufring_gpadl = 0;
 	}
@@ -500,7 +500,6 @@ vmbus_chan_gpadl_connect(struct vmbus_ch
 	 * Allocate GPADL id.
 	 */
 	gpadl = vmbus_gpadl_alloc(sc);
-	*gpadl0 = gpadl;
 
 	/*
 	 * Connect this GPADL to the target channel.
@@ -579,11 +578,13 @@ vmbus_chan_gpadl_connect(struct vmbus_ch
 		vmbus_chan_printf(chan, "gpadl_conn(chan%u) failed: %u\n",
 		    chan->ch_id, status);
 		return EIO;
-	} else {
-		if (bootverbose) {
-			vmbus_chan_printf(chan,
-			    "gpadl_conn(chan%u) succeeded\n", chan->ch_id);
-		}
+	}
+
+	/* Done; commit the GPADL id. */
+	*gpadl0 = gpadl;
+	if (bootverbose) {
+		vmbus_chan_printf(chan, "gpadl_conn(chan%u) succeeded\n",
+		    chan->ch_id);
 	}
 	return 0;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611250535.uAP5ZTo4042898>