@@ -862,30 +862,29 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
862862 * devm_phy_create() will call pm_runtime_enable(&phy->dev);
863863 * And then, phy-core will manage runtime pm for this device.
864864 */
865- pm_runtime_enable (dev );
865+ ret = devm_pm_runtime_enable (dev );
866+ if (ret )
867+ return dev_err_probe (dev , ret , "Failed to enable pm_runtime\n" );
866868
867869 channel -> phy_data = of_device_get_match_data (dev );
868- if (!channel -> phy_data ) {
869- ret = - EINVAL ;
870- goto error ;
871- }
870+ if (!channel -> phy_data )
871+ return - EINVAL ;
872872
873873 platform_set_drvdata (pdev , channel );
874874 channel -> dev = dev ;
875875
876876 ret = rcar_gen3_phy_usb2_init_bus (channel );
877877 if (ret )
878- goto error ;
878+ return ret ;
879879
880880 spin_lock_init (& channel -> lock );
881881 for (i = 0 ; i < NUM_OF_PHYS ; i ++ ) {
882882 channel -> rphys [i ].phy = devm_phy_create (dev , NULL ,
883883 channel -> phy_data -> phy_usb2_ops );
884- if (IS_ERR (channel -> rphys [i ].phy )) {
885- dev_err (dev , "Failed to create USB2 PHY\n" );
886- ret = PTR_ERR (channel -> rphys [i ].phy );
887- goto error ;
888- }
884+ if (IS_ERR (channel -> rphys [i ].phy ))
885+ return dev_err_probe (dev , PTR_ERR (channel -> rphys [i ].phy ),
886+ "Failed to create USB2 PHY\n" );
887+
889888 channel -> rphys [i ].ch = channel ;
890889 channel -> rphys [i ].int_enable_bits = rcar_gen3_int_enable [i ];
891890 phy_set_drvdata (channel -> rphys [i ].phy , & channel -> rphys [i ]);
@@ -896,44 +895,36 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
896895 else
897896 channel -> vbus = devm_regulator_get_optional (dev , "vbus" );
898897 if (IS_ERR (channel -> vbus )) {
899- if (PTR_ERR (channel -> vbus ) == - EPROBE_DEFER ) {
900- ret = PTR_ERR (channel -> vbus );
901- goto error ;
902- }
898+ if (PTR_ERR (channel -> vbus ) == - EPROBE_DEFER )
899+ return PTR_ERR (channel -> vbus );
900+
903901 channel -> vbus = NULL ;
904902 }
905903
906904 irq = platform_get_irq_optional (pdev , 0 );
907905 if (irq < 0 && irq != - ENXIO ) {
908- ret = irq ;
909- goto error ;
906+ return irq ;
910907 } else if (irq > 0 ) {
911908 INIT_WORK (& channel -> work , rcar_gen3_phy_usb2_work );
912909 ret = devm_request_irq (dev , irq , rcar_gen3_phy_usb2_irq ,
913910 IRQF_SHARED , dev_name (dev ), channel );
914- if (ret < 0 ) {
915- dev_err (dev , "Failed to request irq (%d)\n" , irq );
916- goto error ;
917- }
911+ if (ret < 0 )
912+ return dev_err_probe (dev , ret ,
913+ "Failed to request irq (%d)\n" ,
914+ irq );
918915 }
919916
920917 provider = devm_of_phy_provider_register (dev , rcar_gen3_phy_usb2_xlate );
921918 if (IS_ERR (provider )) {
922- dev_err (dev , "Failed to register PHY provider\n" );
923- ret = PTR_ERR (provider );
924- goto error ;
919+ return dev_err_probe (dev , PTR_ERR (provider ),
920+ "Failed to register PHY provider\n" );
925921 } else if (channel -> is_otg_channel ) {
926922 ret = device_create_file (dev , & dev_attr_role );
927923 if (ret < 0 )
928- goto error ;
924+ return ret ;
929925 }
930926
931927 return 0 ;
932-
933- error :
934- pm_runtime_disable (dev );
935-
936- return ret ;
937928}
938929
939930static void rcar_gen3_phy_usb2_remove (struct platform_device * pdev )
@@ -942,8 +933,6 @@ static void rcar_gen3_phy_usb2_remove(struct platform_device *pdev)
942933
943934 if (channel -> is_otg_channel )
944935 device_remove_file (& pdev -> dev , & dev_attr_role );
945-
946- pm_runtime_disable (& pdev -> dev );
947936}
948937
949938static int rcar_gen3_phy_usb2_suspend (struct device * dev )
0 commit comments