Fix CodeSniffer errors and warnings

More fixes will be submitted upstream.

Change-Id: Ib22997f8756537b063fd6eed3f1f74f3eda315d7
Merge "Fix CodeSniffer errors and warnings"