@@ -3568,6 +3568,22 @@ int sdhci_setup_host(struct sdhci_host *host)
3568
3568
}
3569
3569
EXPORT_SYMBOL_GPL (sdhci_setup_host );
3570
3570
3571
+ void sdhci_cleanup_host (struct sdhci_host * host )
3572
+ {
3573
+ struct mmc_host * mmc = host -> mmc ;
3574
+
3575
+ if (!IS_ERR (mmc -> supply .vqmmc ))
3576
+ regulator_disable (mmc -> supply .vqmmc );
3577
+
3578
+ if (host -> align_buffer )
3579
+ dma_free_coherent (mmc_dev (mmc ), host -> align_buffer_sz +
3580
+ host -> adma_table_sz , host -> align_buffer ,
3581
+ host -> align_addr );
3582
+ host -> adma_table = NULL ;
3583
+ host -> align_buffer = NULL ;
3584
+ }
3585
+ EXPORT_SYMBOL_GPL (sdhci_cleanup_host );
3586
+
3571
3587
int __sdhci_add_host (struct sdhci_host * host )
3572
3588
{
3573
3589
struct mmc_host * mmc = host -> mmc ;
@@ -3632,16 +3648,6 @@ int __sdhci_add_host(struct sdhci_host *host)
3632
3648
untasklet :
3633
3649
tasklet_kill (& host -> finish_tasklet );
3634
3650
3635
- if (!IS_ERR (mmc -> supply .vqmmc ))
3636
- regulator_disable (mmc -> supply .vqmmc );
3637
-
3638
- if (host -> align_buffer )
3639
- dma_free_coherent (mmc_dev (mmc ), host -> align_buffer_sz +
3640
- host -> adma_table_sz , host -> align_buffer ,
3641
- host -> align_addr );
3642
- host -> adma_table = NULL ;
3643
- host -> align_buffer = NULL ;
3644
-
3645
3651
return ret ;
3646
3652
}
3647
3653
EXPORT_SYMBOL_GPL (__sdhci_add_host );
@@ -3654,7 +3660,16 @@ int sdhci_add_host(struct sdhci_host *host)
3654
3660
if (ret )
3655
3661
return ret ;
3656
3662
3657
- return __sdhci_add_host (host );
3663
+ ret = __sdhci_add_host (host );
3664
+ if (ret )
3665
+ goto cleanup ;
3666
+
3667
+ return 0 ;
3668
+
3669
+ cleanup :
3670
+ sdhci_cleanup_host (host );
3671
+
3672
+ return ret ;
3658
3673
}
3659
3674
EXPORT_SYMBOL_GPL (sdhci_add_host );
3660
3675
0 commit comments