public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
To: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
Cc: "linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH 2/2] infiniband-diags/ibqueryerrors: Properly exit and clean up resources when node info query fails
Date: Tue, 3 Nov 2009 20:22:47 -0800	[thread overview]
Message-ID: <20091103202247.901acbda.weiny2@llnl.gov> (raw)


From: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
Date: Tue, 3 Nov 2009 20:17:14 -0800
Subject: [PATCH] infiniband-diags/ibqueryerrors: Properly exit and clean up resources when node info query fails


Signed-off-by: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
---
 infiniband-diags/src/ibqueryerrors.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/infiniband-diags/src/ibqueryerrors.c b/infiniband-diags/src/ibqueryerrors.c
index 43698d2..8305e5d 100644
--- a/infiniband-diags/src/ibqueryerrors.c
+++ b/infiniband-diags/src/ibqueryerrors.c
@@ -559,8 +559,10 @@ int main(int argc, char **argv)
 		uint8_t ni[IB_SMP_DATA_SIZE];
 
 		if (!smp_query_via(ni, &portid, IB_ATTR_NODE_INFO, 0,
-				   ibd_timeout, ibmad_port))
-			return -1;
+				   ibd_timeout, ibmad_port)) {
+			rc = -1;
+			goto destroy_fabric;
+		}
 		mad_decode_field(ni, IB_NODE_GUID_F, &(node_guid));
 
 		node = ibnd_find_node_guid(fabric, node_guid);
@@ -571,6 +573,7 @@ int main(int argc, char **argv)
 	} else
 		ibnd_iter_nodes(fabric, print_node, NULL);
 
+destroy_fabric:
 	ibnd_destroy_fabric(fabric);
 
 close_port:
-- 
1.5.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2009-11-04  4:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-04  4:22 Ira Weiny [this message]
     [not found] ` <20091103202247.901acbda.weiny2-i2BcT+NCU+M@public.gmane.org>
2009-11-13  5:59   ` [PATCH 2/2] infiniband-diags/ibqueryerrors: Properly exit and clean up resources when node info query fails Sasha Khapyorsky

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=20091103202247.901acbda.weiny2@llnl.gov \
    --to=weiny2-i2bct+ncu+m@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sashak-smomgflXvOZWk0Htik3J/w@public.gmane.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