@@ -652,10 +652,9 @@ static int pxamci_probe(struct platform_device *pdev)
652652 host -> clkrt = CLKRT_OFF ;
653653
654654 host -> clk = devm_clk_get (dev , NULL );
655- if (IS_ERR (host -> clk )) {
656- host -> clk = NULL ;
657- return PTR_ERR (host -> clk );
658- }
655+ if (IS_ERR (host -> clk ))
656+ return dev_err_probe (dev , PTR_ERR (host -> clk ),
657+ "Failed to acquire clock\n" );
659658
660659 host -> clkrate = clk_get_rate (host -> clk );
661660
@@ -703,46 +702,37 @@ static int pxamci_probe(struct platform_device *pdev)
703702
704703 platform_set_drvdata (pdev , mmc );
705704
706- host -> dma_chan_rx = dma_request_chan (dev , "rx" );
707- if (IS_ERR (host -> dma_chan_rx )) {
708- host -> dma_chan_rx = NULL ;
705+ host -> dma_chan_rx = devm_dma_request_chan (dev , "rx" );
706+ if (IS_ERR (host -> dma_chan_rx ))
709707 return dev_err_probe (dev , PTR_ERR (host -> dma_chan_rx ),
710708 "unable to request rx dma channel\n" );
711- }
712709
713- host -> dma_chan_tx = dma_request_chan (dev , "tx" );
714- if (IS_ERR (host -> dma_chan_tx )) {
715- dev_err (dev , "unable to request tx dma channel\n" );
716- ret = PTR_ERR (host -> dma_chan_tx );
717- host -> dma_chan_tx = NULL ;
718- goto out ;
719- }
710+
711+ host -> dma_chan_tx = devm_dma_request_chan (dev , "tx" );
712+ if (IS_ERR (host -> dma_chan_tx ))
713+ return dev_err_probe (dev , PTR_ERR (host -> dma_chan_tx ),
714+ "unable to request tx dma channel\n" );
720715
721716 if (host -> pdata ) {
722717 host -> detect_delay_ms = host -> pdata -> detect_delay_ms ;
723718
724719 host -> power = devm_gpiod_get_optional (dev , "power" , GPIOD_OUT_LOW );
725- if (IS_ERR (host -> power )) {
726- ret = PTR_ERR (host -> power );
727- dev_err (dev , "Failed requesting gpio_power\n" );
728- goto out ;
729- }
720+ if (IS_ERR (host -> power ))
721+ return dev_err_probe (dev , PTR_ERR (host -> power ),
722+ "Failed requesting gpio_power\n" );
730723
731724 /* FIXME: should we pass detection delay to debounce? */
732725 ret = mmc_gpiod_request_cd (mmc , "cd" , 0 , false, 0 );
733- if (ret && ret != - ENOENT ) {
734- dev_err (dev , "Failed requesting gpio_cd\n" );
735- goto out ;
736- }
726+ if (ret && ret != - ENOENT )
727+ return dev_err_probe (dev , ret , "Failed requesting gpio_cd\n" );
737728
738729 if (!host -> pdata -> gpio_card_ro_invert )
739730 mmc -> caps2 |= MMC_CAP2_RO_ACTIVE_HIGH ;
740731
741732 ret = mmc_gpiod_request_ro (mmc , "wp" , 0 , 0 );
742- if (ret && ret != - ENOENT ) {
743- dev_err (dev , "Failed requesting gpio_ro\n" );
744- goto out ;
745- }
733+ if (ret && ret != - ENOENT )
734+ return dev_err_probe (dev , ret , "Failed requesting gpio_ro\n" );
735+
746736 if (!ret )
747737 host -> use_ro_gpio = true;
748738
@@ -759,16 +749,8 @@ static int pxamci_probe(struct platform_device *pdev)
759749 if (ret ) {
760750 if (host -> pdata && host -> pdata -> exit )
761751 host -> pdata -> exit (dev , mmc );
762- goto out ;
763752 }
764753
765- return 0 ;
766-
767- out :
768- if (host -> dma_chan_rx )
769- dma_release_channel (host -> dma_chan_rx );
770- if (host -> dma_chan_tx )
771- dma_release_channel (host -> dma_chan_tx );
772754 return ret ;
773755}
774756
@@ -791,8 +773,6 @@ static void pxamci_remove(struct platform_device *pdev)
791773
792774 dmaengine_terminate_all (host -> dma_chan_rx );
793775 dmaengine_terminate_all (host -> dma_chan_tx );
794- dma_release_channel (host -> dma_chan_rx );
795- dma_release_channel (host -> dma_chan_tx );
796776 }
797777}
798778
0 commit comments