@@ -3325,8 +3325,10 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device
3325
3325
return dev_err_probe (dev , ret , "Failed to get supplies\n" );
3326
3326
3327
3327
ret = regulator_bulk_enable (WCD938X_MAX_SUPPLY , wcd938x -> supplies );
3328
- if (ret )
3328
+ if (ret ) {
3329
+ regulator_bulk_free (WCD938X_MAX_SUPPLY , wcd938x -> supplies );
3329
3330
return dev_err_probe (dev , ret , "Failed to enable supplies\n" );
3331
+ }
3330
3332
3331
3333
wcd938x_dt_parse_micbias_info (dev , wcd938x );
3332
3334
@@ -3592,13 +3594,13 @@ static int wcd938x_probe(struct platform_device *pdev)
3592
3594
3593
3595
ret = wcd938x_add_slave_components (wcd938x , dev , & match );
3594
3596
if (ret )
3595
- return ret ;
3597
+ goto err_disable_regulators ;
3596
3598
3597
3599
wcd938x_reset (wcd938x );
3598
3600
3599
3601
ret = component_master_add_with_match (dev , & wcd938x_comp_ops , match );
3600
3602
if (ret )
3601
- return ret ;
3603
+ goto err_disable_regulators ;
3602
3604
3603
3605
pm_runtime_set_autosuspend_delay (dev , 1000 );
3604
3606
pm_runtime_use_autosuspend (dev );
@@ -3608,11 +3610,21 @@ static int wcd938x_probe(struct platform_device *pdev)
3608
3610
pm_runtime_idle (dev );
3609
3611
3610
3612
return 0 ;
3613
+
3614
+ err_disable_regulators :
3615
+ regulator_bulk_disable (WCD938X_MAX_SUPPLY , wcd938x -> supplies );
3616
+ regulator_bulk_free (WCD938X_MAX_SUPPLY , wcd938x -> supplies );
3617
+
3618
+ return ret ;
3611
3619
}
3612
3620
3613
3621
static void wcd938x_remove (struct platform_device * pdev )
3614
3622
{
3623
+ struct wcd938x_priv * wcd938x = dev_get_drvdata (& pdev -> dev );
3624
+
3615
3625
component_master_del (& pdev -> dev , & wcd938x_comp_ops );
3626
+ regulator_bulk_disable (WCD938X_MAX_SUPPLY , wcd938x -> supplies );
3627
+ regulator_bulk_free (WCD938X_MAX_SUPPLY , wcd938x -> supplies );
3616
3628
}
3617
3629
3618
3630
#if defined(CONFIG_OF )
0 commit comments