Skip to content

Commit f76a30a

Browse files
committed
Merge tag 'mmc-v6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull mmc fixes from Ulf Hansson: "MMC core: - Fix NULL dereference for mmc_test on allocation failure MMC host: - dw_mmc: Fix support for deferred probe for biu/ciu clocks - mtk-sd: Fix CMD8 support when fragile tuning settings" * tag 'mmc-v6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: mmc_test: Fix NULL dereference on allocation failure mmc: dw_mmc: allow biu and ciu clocks to defer mmc: mtk-sd: receive cmd8 data when hs400 tuning fail
2 parents c2a905a + a1e627a commit f76a30a

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

drivers/mmc/core/mmc_test.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3125,20 +3125,21 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf,
31253125
test->buffer = kzalloc(BUFFER_SIZE, GFP_KERNEL);
31263126
#ifdef CONFIG_HIGHMEM
31273127
test->highmem = alloc_pages(GFP_KERNEL | __GFP_HIGHMEM, BUFFER_ORDER);
3128+
if (!test->highmem) {
3129+
count = -ENOMEM;
3130+
goto free_test_buffer;
3131+
}
31283132
#endif
31293133

3130-
#ifdef CONFIG_HIGHMEM
3131-
if (test->buffer && test->highmem) {
3132-
#else
31333134
if (test->buffer) {
3134-
#endif
31353135
mutex_lock(&mmc_test_lock);
31363136
mmc_test_run(test, testcase);
31373137
mutex_unlock(&mmc_test_lock);
31383138
}
31393139

31403140
#ifdef CONFIG_HIGHMEM
31413141
__free_pages(test->highmem, BUFFER_ORDER);
3142+
free_test_buffer:
31423143
#endif
31433144
kfree(test->buffer);
31443145
kfree(test);

drivers/mmc/host/dw_mmc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3299,6 +3299,10 @@ int dw_mci_probe(struct dw_mci *host)
32993299
host->biu_clk = devm_clk_get(host->dev, "biu");
33003300
if (IS_ERR(host->biu_clk)) {
33013301
dev_dbg(host->dev, "biu clock not available\n");
3302+
ret = PTR_ERR(host->biu_clk);
3303+
if (ret == -EPROBE_DEFER)
3304+
return ret;
3305+
33023306
} else {
33033307
ret = clk_prepare_enable(host->biu_clk);
33043308
if (ret) {
@@ -3310,6 +3314,10 @@ int dw_mci_probe(struct dw_mci *host)
33103314
host->ciu_clk = devm_clk_get(host->dev, "ciu");
33113315
if (IS_ERR(host->ciu_clk)) {
33123316
dev_dbg(host->dev, "ciu clock not available\n");
3317+
ret = PTR_ERR(host->ciu_clk);
3318+
if (ret == -EPROBE_DEFER)
3319+
goto err_clk_biu;
3320+
33133321
host->bus_hz = host->pdata->bus_hz;
33143322
} else {
33153323
ret = clk_prepare_enable(host->ciu_clk);

drivers/mmc/host/mtk-sd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ static bool msdc_cmd_done(struct msdc_host *host, int events,
12301230
}
12311231

12321232
if (!sbc_error && !(events & MSDC_INT_CMDRDY)) {
1233-
if (events & MSDC_INT_CMDTMO ||
1233+
if ((events & MSDC_INT_CMDTMO && !host->hs400_tuning) ||
12341234
(!mmc_op_tuning(cmd->opcode) && !host->hs400_tuning))
12351235
/*
12361236
* should not clear fifo/interrupt as the tune data
@@ -1323,9 +1323,9 @@ static void msdc_start_command(struct msdc_host *host,
13231323
static void msdc_cmd_next(struct msdc_host *host,
13241324
struct mmc_request *mrq, struct mmc_command *cmd)
13251325
{
1326-
if ((cmd->error &&
1327-
!(cmd->error == -EILSEQ &&
1328-
(mmc_op_tuning(cmd->opcode) || host->hs400_tuning))) ||
1326+
if ((cmd->error && !host->hs400_tuning &&
1327+
!(cmd->error == -EILSEQ &&
1328+
mmc_op_tuning(cmd->opcode))) ||
13291329
(mrq->sbc && mrq->sbc->error))
13301330
msdc_request_done(host, mrq);
13311331
else if (cmd == mrq->sbc)

0 commit comments

Comments
 (0)