[ofw] PATCH: Fix error handling of mlx4_bus driver.

Tzachi Dar tzachid at mellanox.co.il
Sun Feb 8 06:55:51 PST 2009


Index: Q:/projinf2/trunk/hw/mlx4/kernel/bus/core/device.c
===================================================================
--- Q:/projinf2/trunk/hw/mlx4/kernel/bus/core/device.c (revision 3919)
+++ Q:/projinf2/trunk/hw/mlx4/kernel/bus/core/device.c (revision 3920)
@@ -332,6 +332,11 @@
  struct ib_client_data *context, *tmp;
  unsigned long flags;
 
+ if(device->reg_state != IB_DEV_REGISTERED) {
+  ASSERT(FALSE);
+  return;
+ }
+
  mutex_lock(&device_mutex);
 
  list_for_each_entry_reverse(client, &client_list, list, struct
ib_client)
@@ -340,8 +345,14 @@
 
  list_del(&device->core_list);
 
- kfree(device->gid_tbl_len);
- kfree(device->pkey_tbl_len);
+ if (device->gid_tbl_len) {
+  kfree(device->gid_tbl_len);
+  device->gid_tbl_len = NULL;
+ }
+ if(device->pkey_tbl_len) {
+  kfree(device->pkey_tbl_len);
+  device->pkey_tbl_len = NULL;
+ }
 
  mutex_unlock(&device_mutex);
 
Index: Q:/projinf2/trunk/hw/mlx4/kernel/bus/ib/main.c
===================================================================
--- Q:/projinf2/trunk/hw/mlx4/kernel/bus/ib/main.c (revision 3919)
+++ Q:/projinf2/trunk/hw/mlx4/kernel/bus/ib/main.c (revision 3920)
@@ -621,8 +621,10 @@
  struct mlx4_ib_dev *ibdev = ibdev_ptr;
  int p;
 
- if (mlx4_is_livefish(ibdev->dev))
+ if (mlx4_is_livefish(ibdev->dev)) {
+  ib_unregister_device(&ibdev->ib_dev);
   goto dealloc_dev;
+ }
  
  for (p = 1; p <= dev->caps.num_ports; ++p)
   mlx4_CLOSE_PORT(dev, p);
Index: Q:/projinf2/trunk/hw/mlx4/kernel/hca/drv.c
===================================================================
--- Q:/projinf2/trunk/hw/mlx4/kernel/hca/drv.c (revision 3919)
+++ Q:/projinf2/trunk/hw/mlx4/kernel/hca/drv.c (revision 3920)
@@ -713,7 +713,7 @@
 
  HCA_ENTER( HCA_DBG_PNP );
 
- HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_PNP, ("EvtReleaseHardware:
FdoData=0x%p\n", p_fdo));
+ HCA_PRINT(TRACE_LEVEL_INFORMATION, HCA_DBG_PNP,
("EvtDeviceReleaseHardware: FdoData=0x%p\n", p_fdo));
 
  // release IBBUS resources
  __hca_release_resources(Device);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090208/962b7fbe/attachment.html>


More information about the ofw mailing list