]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/mmc/host/bcm2835.c
mmc: bcm2835: Fix DMA channel leak on probe error
[mirror_ubuntu-bionic-kernel.git] / drivers / mmc / host / bcm2835.c
index 229dc18f0581beb26733222be97f981b2038fb60..0d3b7473bc218b563c71706b40b7987099ac1dec 100644 (file)
@@ -1265,7 +1265,8 @@ static int bcm2835_add_host(struct bcm2835_host *host)
        char pio_limit_string[20];
        int ret;
 
-       mmc->f_max = host->max_clk;
+       if (!mmc->f_max || mmc->f_max > host->max_clk)
+               mmc->f_max = host->max_clk;
        mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV;
 
        mmc->max_busy_timeout = ~0 / (mmc->f_max / 1000);
@@ -1426,6 +1427,8 @@ static int bcm2835_probe(struct platform_device *pdev)
 
 err:
        dev_dbg(dev, "%s -> err %d\n", __func__, ret);
+       if (host->dma_chan_rxtx)
+               dma_release_channel(host->dma_chan_rxtx);
        mmc_free_host(mmc);
 
        return ret;