platform: msm_shared: Fix fifo overflow condition

When multiple requests are sent to RPM the smd driver overwrites
beyond the limit of fifo size and causes the device to crash.
Before writing any request to the RPM fifo make sure to check
for overflow conditions and the wrap the read and write index
to the beginning of the FIFO.

Change-Id: Ie73f68ff4bdc1a957dbd19f076f9b6422485ecb7
1 file changed