Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: dw_mmc: replace the bus_hz checking point

It's right to check immediately whether host->bus_hz is assigned or not.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>

authored by

Jaehoon Chung and committed by
Chris Ball
612de4c1 d8a4fb0e

+8 -10
+8 -10
drivers/mmc/host/dw_mmc.c
··· 2427 2427 ret = clk_set_rate(host->ciu_clk, host->pdata->bus_hz); 2428 2428 if (ret) 2429 2429 dev_warn(host->dev, 2430 - "Unable to set bus rate to %ul\n", 2430 + "Unable to set bus rate to %uHz\n", 2431 2431 host->pdata->bus_hz); 2432 2432 } 2433 2433 host->bus_hz = clk_get_rate(host->ciu_clk); 2434 + } 2435 + 2436 + if (!host->bus_hz) { 2437 + dev_err(host->dev, 2438 + "Platform data must supply bus speed\n"); 2439 + ret = -ENODEV; 2440 + goto err_clk_ciu; 2434 2441 } 2435 2442 2436 2443 if (drv_data && drv_data->init) { ··· 2474 2467 "regulator_enable fail: %d\n", ret); 2475 2468 goto err_clk_ciu; 2476 2469 } 2477 - } 2478 - 2479 - if (!host->bus_hz) { 2480 - dev_err(host->dev, 2481 - "Platform data must supply bus speed\n"); 2482 - ret = -ENODEV; 2483 - goto err_regulator; 2484 2470 } 2485 2471 2486 2472 host->quirks = host->pdata->quirks; ··· 2619 2619 err_dmaunmap: 2620 2620 if (host->use_dma && host->dma_ops->exit) 2621 2621 host->dma_ops->exit(host); 2622 - 2623 - err_regulator: 2624 2622 if (host->vmmc) 2625 2623 regulator_disable(host->vmmc); 2626 2624