Fix for Null Pointer dereference
authorAshish K Singh <ashish.k.singh@intel.com>
Thu, 3 May 2012 10:15:21 +0000 (15:45 +0530)
committerbuildbot <buildbot@intel.com>
Sat, 5 May 2012 00:43:21 +0000 (17:43 -0700)
BZ: 34186

Matrix.c file was showing Null Pointer Dereferencecritical issue with Klockwork tool.

Change-Id: I340d7c7a84ec8dc1b9abf6edc2484fa52d0cf637
Signed-off-by: Ashish K Singh <ashish.k.singh@intel.com>
Reviewed-on: http://android.intel.com:8080/47199
Reviewed-by: Yang, Fei <fei.yang@intel.com>
Reviewed-by: Gross, Mark <mark.gross@intel.com>
Tested-by: Ng, Cheon-woei <cheon-woei.ng@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/staging/matrix/matrix.c

index bf17169..1bfbd0e 100644 (file)
@@ -164,10 +164,10 @@ static struct mtx_size_info xhg_buf_info;
                        ptr_lut->member##_##state =  \
                                (struct_init structure*)&ptr_lut_ops[offset]; \
                        offset += lut_info.state##_##type##_size; \
+                       if (mem) \
+                               IO_REMAP_MEMORY(state); \
                } else \
                        ptr_lut->member##_##state = NULL; \
-               if (mem) \
-                       IO_REMAP_MEMORY(state); \
        } while (0)
 
 #define BOOK_MARK_EXCHANGE_BUFFER(state, type, cu, cl, mem) \