@@ -631,19 +631,26 @@ static int ebu_nand_probe(struct platform_device *pdev)
631
631
ebu_host -> clk_rate = clk_get_rate (ebu_host -> clk );
632
632
633
633
ebu_host -> dma_tx = dma_request_chan (dev , "tx" );
634
- if (IS_ERR (ebu_host -> dma_tx ))
635
- return dev_err_probe (dev , PTR_ERR (ebu_host -> dma_tx ),
636
- "failed to request DMA tx chan!.\n" );
634
+ if (IS_ERR (ebu_host -> dma_tx )) {
635
+ ret = dev_err_probe (dev , PTR_ERR (ebu_host -> dma_tx ),
636
+ "failed to request DMA tx chan!.\n" );
637
+ goto err_disable_unprepare_clk ;
638
+ }
637
639
638
640
ebu_host -> dma_rx = dma_request_chan (dev , "rx" );
639
- if (IS_ERR (ebu_host -> dma_rx ))
640
- return dev_err_probe (dev , PTR_ERR (ebu_host -> dma_rx ),
641
- "failed to request DMA rx chan!.\n" );
641
+ if (IS_ERR (ebu_host -> dma_rx )) {
642
+ ret = dev_err_probe (dev , PTR_ERR (ebu_host -> dma_rx ),
643
+ "failed to request DMA rx chan!.\n" );
644
+ ebu_host -> dma_rx = NULL ;
645
+ goto err_cleanup_dma ;
646
+ }
642
647
643
648
resname = devm_kasprintf (dev , GFP_KERNEL , "addr_sel%d" , cs );
644
649
res = platform_get_resource_byname (pdev , IORESOURCE_MEM , resname );
645
- if (!res )
646
- return - EINVAL ;
650
+ if (!res ) {
651
+ ret = - EINVAL ;
652
+ goto err_cleanup_dma ;
653
+ }
647
654
ebu_host -> cs [cs ].addr_sel = res -> start ;
648
655
writel (ebu_host -> cs [cs ].addr_sel | EBU_ADDR_MASK (5 ) | EBU_ADDR_SEL_REGEN ,
649
656
ebu_host -> ebu + EBU_ADDR_SEL (cs ));
@@ -653,7 +660,8 @@ static int ebu_nand_probe(struct platform_device *pdev)
653
660
mtd = nand_to_mtd (& ebu_host -> chip );
654
661
if (!mtd -> name ) {
655
662
dev_err (ebu_host -> dev , "NAND label property is mandatory\n" );
656
- return - EINVAL ;
663
+ ret = - EINVAL ;
664
+ goto err_cleanup_dma ;
657
665
}
658
666
659
667
mtd -> dev .parent = dev ;
@@ -681,6 +689,7 @@ static int ebu_nand_probe(struct platform_device *pdev)
681
689
nand_cleanup (& ebu_host -> chip );
682
690
err_cleanup_dma :
683
691
ebu_dma_cleanup (ebu_host );
692
+ err_disable_unprepare_clk :
684
693
clk_disable_unprepare (ebu_host -> clk );
685
694
686
695
return ret ;
0 commit comments