mmc: msm_sdcc: fix mismatched clock api calls

During probe after setting up sdcc core clock with clk_enable_prepare(),
if there are any errors, the core clock is turned off but with
clk_disable() instead of the matching clk_disable_unprepare(). This
causes the clock driver to retain the vote for core clock thus
preventing tcxo shutdown.

Change-Id: I818a7c70800d23804d06dd768159c4de6ef5eda1
Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
mmc: core: Fix null pointer dereference due to race conditions

Fix race condition between mmcqd thread and the mmc_queue_suspend
updating a shared variable mq->flags, which can lead to potential
null pointer dereference as following-

Unable to handle kernel NULL pointer dereference at
virtual address 00000020
pgd = c0004000
[00000020] *pgd=00000000
mmcqd/0:  186] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
CPU: 0    Tainted: G        W     (3.4.0-1251694-eng #1)
PC is at mmc_blk_err_check+0x20c/0x3b8
LR is at mmc_start_req+0x198/0x718

cpu0		|	cpu1
x |= 1		|	x |= 2

final value of x can be x = 1 or x = 2

Change-Id: Ie0fff6d6dba5aebb3584cba9fb98de24515c4cd8
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Dorimanx note:
i have the next mmc commit
https://github.com/neobuddy89/hammerhead_kernel_caf/commit/a36865db45a54e53c8fcbc7c32a6bb12251ac901

so i have merged this one + one i had.
mmc: queue: scale down the max_segs if memory allocation fails

In low memory conditions at runtime, allocation of max_segs may
fail. Retry with a scaled down max_segs until allocation succeeds.

CRs-fixed: 583267
Change-Id: I072724afa44854dacc58654e6329531c1bb11120
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>