[ofw] PATCH: [hw] Don't try to write to event log when there is no driver object.

Tzachi Dar tzachid at mellanox.co.il
Mon Feb 9 09:04:06 PST 2009


The following checkin prevents blue screens that were found when running
with the driver verifier.
 
 
Index: Q:/projinf2/trunk/hw/mlx4/kernel/bus/core/l2w_debug.c
===================================================================
--- Q:/projinf2/trunk/hw/mlx4/kernel/bus/core/l2w_debug.c (revision
3931)
+++ Q:/projinf2/trunk/hw/mlx4/kernel/bus/core/l2w_debug.c (revision
3932)
@@ -45,6 +45,11 @@
  int l_PktSize
=sizeof(IO_ERROR_LOG_PACKET)+pi_nDataItems*sizeof(ULONG);
  int l_TotalSize =l_PktSize +l_Size;
 
+ if (pi_pIoObject == NULL) {
+  ASSERT(FALSE);
+  return;
+ }
+
  /* Init the variable argument list */   
  va_start(l_Argptr, pi_nDataItems);
 
@@ -132,6 +137,13 @@
  // print to Debugger
  va_start(list, format);
  buf[MAX_BUFFER_SIZE - 1] = '\0';
+
+ if (mdev == NULL) {
+  ASSERT(FALSE);
+  return;
+ }
+
+ 
  if (RtlStringCbVPrintfA( (char*)buf, sizeof(buf), format, list))
   return;
  cl_dbg_out( "%s\n", (char*)buf );
@@ -177,6 +189,11 @@
  UCHAR  buf[MAX_BUFFER_SIZE];
  WCHAR  wbuf[MAX_BUFFER_SIZE];
 
+ if (mdev == NULL) {
+  ASSERT(FALSE);
+  return;
+ }
+
  // print to Debugger
  va_start(list, format);
  buf[MAX_BUFFER_SIZE - 1] = '\0';
Index: Q:/projinf2/trunk/hw/mlx4/kernel/inc/l2w.h
===================================================================
--- Q:/projinf2/trunk/hw/mlx4/kernel/inc/l2w.h (revision 3931)
+++ Q:/projinf2/trunk/hw/mlx4/kernel/inc/l2w.h (revision 3932)
@@ -326,6 +326,9 @@
 
 static inline int mlx4_is_livefish(struct mlx4_dev *dev)
 {
+ if (dev == NULL) {
+  return TRUE;
+ }
  return !!(dev->flags & MLX4_FLAG_LIVEFISH);
 }
 
Index: Q:/projinf2/trunk/hw/mlx4/kernel/hca/drv.h
===================================================================
--- Q:/projinf2/trunk/hw/mlx4/kernel/hca/drv.h (revision 3931)
+++ Q:/projinf2/trunk/hw/mlx4/kernel/hca/drv.h (revision 3932)
@@ -243,6 +243,9 @@
 
 static inline boolean_t hca_is_livefish(PFDO_DEVICE_DATA p_fdo)
 {
+ if (p_fdo == NULL) {
+  return TRUE;
+ }
  return p_fdo->bus_ib_ifc.is_livefish;
 }
 
Index: Q:/projinf2/trunk/hw/mthca/kernel/hca_debug.h
===================================================================
--- Q:/projinf2/trunk/hw/mthca/kernel/hca_debug.h (revision 3931)
+++ Q:/projinf2/trunk/hw/mthca/kernel/hca_debug.h (revision 3932)
@@ -63,7 +63,11 @@
  }
 
 #define HCA_PRINT_EV_MDEV(_level_,_flag_,_msg_)  \
-
HCA_PRINT_TO_EVENT_LOG(mdev->ext->cl_ext.p_self_do,_level_,_flag_,_msg_)
+{\
+ if(mdev) {\
+
HCA_PRINT_TO_EVENT_LOG(mdev->ext->cl_ext.p_self_do,_level_,_flag_,_msg_)
\
+ }\
+}\
 
 
 #if defined(EVENT_TRACING)
Index: Q:/projinf2/trunk/hw/mthca/kernel/mthca_log.c
===================================================================
--- Q:/projinf2/trunk/hw/mthca/kernel/mthca_log.c (revision 3931)
+++ Q:/projinf2/trunk/hw/mthca/kernel/mthca_log.c (revision 3932)
@@ -73,6 +73,10 @@
  /* Init the variable argument list */   
  va_start(l_Argptr, pi_nDataItems);
 
+ if(pi_pIoObject == NULL) {
+  return;
+ }
+ 
  /* Allocate an error log entry */ 
     l_pErrorLogEntry = 
  (PIO_ERROR_LOG_PACKET)IoAllocateErrorLogEntry(
@@ -165,6 +169,10 @@
  int l_PktSize
=sizeof(IO_ERROR_LOG_PACKET)+pi_nDataItems*sizeof(ULONG);
  int l_TotalSize =l_PktSize +l_Size;
 
+ if(pi_pIoObject == NULL) {
+  return;
+ }
+ 
  /* Init the variable argument list */   
  va_start(l_Argptr, pi_nDataItems);
 
Index: Q:/projinf2/trunk/hw/mthca/kernel/mthca_dev.h
===================================================================
--- Q:/projinf2/trunk/hw/mthca/kernel/mthca_dev.h (revision 3931)
+++ Q:/projinf2/trunk/hw/mthca/kernel/mthca_dev.h (revision 3932)
@@ -598,6 +598,9 @@
 
 static inline int mthca_is_livefish(struct mthca_dev *mdev)
 {
+ if(mdev == NULL) {
+  return TRUE;
+ }
  return mdev->mthca_flags & MTHCA_FLAG_LIVEFISH;
 }
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090209/44914e45/attachment.html>


More information about the ofw mailing list