Work around a bug in Immersion's libImmEmulatorJ.so.

This library calls pthread_mutex_lock and pthread_mutex_unlock with a NULL
pthread_mutex_t*. This gives them (and their users) one release to fix things.

Bug: 17443936

(cherry picked from commit 7d3f553f989f830976efa92ddc3c84661d4d42aa)

Change-Id: Ie26bbecd3a74d61113b51c18832872499b97ee86
diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp
index 5461661..ae2557f 100644
--- a/libc/bionic/pthread_mutex.cpp
+++ b/libc/bionic/pthread_mutex.cpp
@@ -440,6 +440,12 @@
 }
 
 int pthread_mutex_lock(pthread_mutex_t* mutex) {
+#if !defined(__LP64__)
+    if (mutex == NULL) {
+        return EINVAL;
+    }
+#endif
+
     int mvalue, mtype, tid, shared;
 
     mvalue = mutex->value;
@@ -516,6 +522,12 @@
 }
 
 int pthread_mutex_unlock(pthread_mutex_t* mutex) {
+#if !defined(__LP64__)
+    if (mutex == NULL) {
+        return EINVAL;
+    }
+#endif
+
     int mvalue, mtype, tid, shared;
 
     mvalue = mutex->value;