mmc: sdhci: Clear unused bounce buffer at DMA mmap error path
[linux-2.6-microblaze.git] / drivers / mmc / host / sdhci.c
index 6aaf5c3..cf01b6f 100644 (file)
@@ -4072,9 +4072,13 @@ static void sdhci_allocate_bounce_buffer(struct sdhci_host *host)
                                           bounce_size,
                                           DMA_BIDIRECTIONAL);
        ret = dma_mapping_error(mmc_dev(mmc), host->bounce_addr);
-       if (ret)
+       if (ret) {
+               devm_kfree(mmc_dev(mmc), host->bounce_buffer);
+               host->bounce_buffer = NULL;
                /* Again fall back to max_segs == 1 */
                return;
+       }
+
        host->bounce_buffer_size = bounce_size;
 
        /* Lie about this since we're bouncing */