msm: mdss: Fix race conditions during device shutdown

Wait for the display commit thread to exit and abort all
pending ioctls when releasing the framebuffer device. This is
necessary to address any potential race conditions between these
threads that operate on a common data structure.

Change-Id: I5ab32758c34d4e80c4e85f949ffa0054d3cb5340
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
msm: mdss: stop display commit thread only if it is running

When the framebuffer device is shutdown, it is possible that
the display commit thread has already been stopped. In such
scenarios, ensure that we not attempt to stop the thread again
to avoid any potential crashes.

CRs-Fixed: 584499
Change-Id: If0026cdcc4367c149815933ffe4ed08056d54770
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
msm: mdss: Fix NULL pointer dereference in mdss_mdp_display_wait4comp

Add sanity check for ctl to prevent NULL pointer dereference
leading to kernel panic.

CRs-Fixed: 578595
Change-Id: Iace727501856d9f93ba87eca92f9f000c32d2c8f
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
msm: mdss: initialize pipe to NULL

Initialize the pipe pointer to NULL.
So that even if the selection of pipe from pipe-pool
fails, the function returns NULL instead of an
uninitialized value.

Change-Id: Ib04c0a983cba6ffe9532862bcaf516877e49746a
CRs-Fixed: 524466
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>