init: device: fix memory leak issue

Fix some memory leak and null pointer issues reported by KW.

Change-Id: I61df734380498b68cdb4c3f66dcf5771e9e191eb
Signed-off-by: Hong-Mei Li <a21834@motorola.com>
Reviewed-on: http://gerrit.pcs.mot.com/549753
SLT-Approved: Slta Waiver <sltawvr@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Patrick Auchter <auchter@motorola.com>
Reviewed-by: Jeffrey Carlyle <jeff.carlyle@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
(cherry picked from commit dab2f49656556281f8e8ac313c7023355f705489)
Handle SIGPIPE gracefully in logcat

logcat's output is sometimes redirected into a socket (ex: bugreport).
If that socket is then closed, logcat gets a SIGPIPE and crashes,
resulting in a tombstone.  Since this is a normal case, a tombstone is
not warranted.  It should just exit gracefully instead.

Change-Id: Ic2d2eca035f4b8a22778763d81932a064aeef5a5
Reviewed-on: http://gerrit.pcs.mot.com/536586
SLT-Approved: Slta Waiver <sltawvr@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Klocwork kwcheck <klocwork-kwcheck@sourceforge.mot.com>
Reviewed-by: Jeffrey Carlyle <jeff.carlyle@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
Handle SIGPIPE gracefully in top

top's output is sometimes redirected into a socket (ex: bugreport).
If that socket is then closed, top gets a SIGPIPE and crashes,
resulting in a tombstone.  Since this is a normal case, a tombstone is
not warranted.  It should just exit gracefully instead.

Change-Id: I0087401af36bfc72446d58b3043251ccd6884eda
Reviewed-on: http://gerrit.pcs.mot.com/536587
SLT-Approved: Slta Waiver <sltawvr@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Klocwork kwcheck <klocwork-kwcheck@sourceforge.mot.com>
Reviewed-by: Jeffrey Carlyle <jeff.carlyle@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
ps exits when gets the signal SIGPIPE

ps's output is sometimes redirected into a socket (ex: bugreport). If
that socket is then closed, ps gets a SIGPIPE and crashes, resulting
in a tombstone.  It is better that ps just exits gracefully instead.

Change-Id: Id5bf73f626580dca2ab03b6f12a444be1640407c
Reviewed-on: http://gerrit.pcs.mot.com/537642
SLT-Approved: Slta Waiver <sltawvr@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Klocwork kwcheck <klocwork-kwcheck@sourceforge.mot.com>
Reviewed-by: Xue-Ying Hou <a16543@email.mot.com>
Reviewed-by: John Michelau <w14107@motorola.com>
Reviewed-by: Xin Guan <a18772@motorola.com>
Reviewed-by: David Ding <dding@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
audio: New audio formats for PCM Offload

- Add new formats 16/24 bit PCM offload formats

Conflicts:

	include/system/audio.h

Change-Id: I1a0eb1504d8436a679e4c14e199aa2e443b5ebf1
Merge "audio: New audio formats for PCM Offload" into du44
Update to 4.4.3 r1.1

Change-Id: Ifa732ec52fb582c34512cd1d09d918199ae9920e
ueventd: fix a busy loop while reading uevents

Under certain conditions, poll() may raise the POLLERR
flag along with POLLIN, in which case the check for
(ufd.revents == POLLIN) results in an endless busy loop.

The following fix was applied to
hardware/libhardware_legacy/uevent/uevent.c
to fix a similar bug:

  commit 3aabb260ceef10377c31c9e45fb239247f5cfeba
  Author: Mathias Agopian <mathias@google.com>
  Date:   Mon Oct 1 14:53:18 2012 -0700

    fix a typo in uevent_next_eventi

    Bug: 7114973
    Change-Id: I15a4c714b59aeb1d02db00517d70b5f0e5ab22c2

Applying the same fix for two more poll loops in init
and ueventd.

https://android.googlesource.com/platform/hardware/libhardware_legacy.git/+/3aabb260ceef10377c31c9e45fb239247f5cfeba
Signed-off-by: houst0nn <houstonn@gmail.com>
Change-Id: I50693f6d3c904992ac4b8a9a14a83c7106e6b9e0
RECOVERY_PRE_COMMAND_CLEAR_REASON and extended reboot arguments

fix the 2 new warnings created by our 4-lines recovery patch ;p

Change-Id: I975af19a8f295d1e341c7433f96f669db611f89c
Merge "RECOVERY_PRE_COMMAND_CLEAR_REASON and extended reboot arguments" into du44
Merge branch 'du44' of https://github.com/DirtyUnicorns-KitKat/system_core into HEAD