@@ -608,30 +608,35 @@ static int ebu_nand_probe(struct platform_device *pdev)
608608 ret = of_property_read_u32 (chip_np , "reg" , & cs );
609609 if (ret ) {
610610 dev_err (dev , "failed to get chip select: %d\n" , ret );
611- return ret ;
611+ goto err_of_node_put ;
612612 }
613613 if (cs >= MAX_CS ) {
614614 dev_err (dev , "got invalid chip select: %d\n" , cs );
615- return - EINVAL ;
615+ ret = - EINVAL ;
616+ goto err_of_node_put ;
616617 }
617618
618619 ebu_host -> cs_num = cs ;
619620
620621 resname = devm_kasprintf (dev , GFP_KERNEL , "nand_cs%d" , cs );
621622 ebu_host -> cs [cs ].chipaddr = devm_platform_ioremap_resource_byname (pdev ,
622623 resname );
623- if (IS_ERR (ebu_host -> cs [cs ].chipaddr ))
624- return PTR_ERR (ebu_host -> cs [cs ].chipaddr );
624+ if (IS_ERR (ebu_host -> cs [cs ].chipaddr )) {
625+ ret = PTR_ERR (ebu_host -> cs [cs ].chipaddr );
626+ goto err_of_node_put ;
627+ }
625628
626629 ebu_host -> clk = devm_clk_get (dev , NULL );
627- if (IS_ERR (ebu_host -> clk ))
628- return dev_err_probe (dev , PTR_ERR (ebu_host -> clk ),
629- "failed to get clock\n" );
630+ if (IS_ERR (ebu_host -> clk )) {
631+ ret = dev_err_probe (dev , PTR_ERR (ebu_host -> clk ),
632+ "failed to get clock\n" );
633+ goto err_of_node_put ;
634+ }
630635
631636 ret = clk_prepare_enable (ebu_host -> clk );
632637 if (ret ) {
633638 dev_err (dev , "failed to enable clock: %d\n" , ret );
634- return ret ;
639+ goto err_of_node_put ;
635640 }
636641
637642 ebu_host -> dma_tx = dma_request_chan (dev , "tx" );
@@ -695,6 +700,8 @@ static int ebu_nand_probe(struct platform_device *pdev)
695700 ebu_dma_cleanup (ebu_host );
696701err_disable_unprepare_clk :
697702 clk_disable_unprepare (ebu_host -> clk );
703+ err_of_node_put :
704+ of_node_put (chip_np );
698705
699706 return ret ;
700707}
0 commit comments