- Switched to a more traditional error handling style with regard to MAD
authorbvassche <bvassche@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Thu, 21 May 2009 11:28:09 +0000 (11:28 +0000)
committerbvassche <bvassche@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Thu, 21 May 2009 11:28:09 +0000 (11:28 +0000)
  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: https://scst.svn.sourceforge.net/svnroot/scst/trunk@877 d57e44dd-8a1f-0410-8b47-8ef2f437770f

srpt/src/ib_srpt.c

index 442e9cd..34928df 100644 (file)
@@ -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;
                }