From 106acdb7d6a85ba20e3a061fd945aaf48dbb851e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 21 May 2009 11:28:09 +0000 Subject: [PATCH] - Switched to a more traditional error handling style with regard to MAD handler registration: sport->mad_agent is now reset to NULL when MAD handler registration fails. - Fixed bug in srpt_refresh_port(): this function now returns a negative value instead of zero when MAD registration fails. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@877 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 442e9cd5b..34928dfe4 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -465,8 +465,11 @@ static int srpt_refresh_port(struct srpt_port *sport) srpt_mad_send_handler, srpt_mad_recv_handler, sport); - if (IS_ERR(sport->mad_agent)) + if (IS_ERR(sport->mad_agent)) { + ret = PTR_ERR(sport->mad_agent); + sport->mad_agent = NULL; goto err_query_port; + } } return 0; @@ -501,7 +504,7 @@ static void srpt_unregister_mad_agent(struct srpt_device *sdev) if (ib_modify_port(sdev->device, i, 0, &port_modify) < 0) printk(KERN_ERR PFX "disabling MAD processing" " failed.\n"); - if (sport->mad_agent && !IS_ERR(sport->mad_agent)) { + if (sport->mad_agent) { ib_unregister_mad_agent(sport->mad_agent); sport->mad_agent = NULL; }