- 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
This commit is contained in:
Bart Van Assche
2009-05-21 11:28:09 +00:00
parent 00dcebdb41
commit 106acdb7d6
+5 -2
View 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;
}