@@ -463,29 +463,40 @@ static int nb7vpq904m_probe(struct i2c_client *client)
463
463
464
464
ret = nb7vpq904m_register_bridge (nb7 );
465
465
if (ret )
466
- return ret ;
466
+ goto err_disable_gpio ;
467
467
468
468
sw_desc .drvdata = nb7 ;
469
469
sw_desc .fwnode = dev -> fwnode ;
470
470
sw_desc .set = nb7vpq904m_sw_set ;
471
471
472
472
nb7 -> sw = typec_switch_register (dev , & sw_desc );
473
- if (IS_ERR (nb7 -> sw ))
474
- return dev_err_probe (dev , PTR_ERR (nb7 -> sw ),
475
- "Error registering typec switch\n" );
473
+ if (IS_ERR (nb7 -> sw )) {
474
+ ret = dev_err_probe (dev , PTR_ERR (nb7 -> sw ),
475
+ "Error registering typec switch\n" );
476
+ goto err_disable_gpio ;
477
+ }
476
478
477
479
retimer_desc .drvdata = nb7 ;
478
480
retimer_desc .fwnode = dev -> fwnode ;
479
481
retimer_desc .set = nb7vpq904m_retimer_set ;
480
482
481
483
nb7 -> retimer = typec_retimer_register (dev , & retimer_desc );
482
484
if (IS_ERR (nb7 -> retimer )) {
483
- typec_switch_unregister ( nb7 -> sw );
484
- return dev_err_probe ( dev , PTR_ERR ( nb7 -> retimer ),
485
- "Error registering typec retimer\n" ) ;
485
+ ret = dev_err_probe ( dev , PTR_ERR ( nb7 -> retimer ),
486
+ "Error registering typec retimer\n" );
487
+ goto err_switch_unregister ;
486
488
}
487
489
488
490
return 0 ;
491
+
492
+ err_switch_unregister :
493
+ typec_switch_unregister (nb7 -> sw );
494
+
495
+ err_disable_gpio :
496
+ gpiod_set_value (nb7 -> enable_gpio , 0 );
497
+ regulator_disable (nb7 -> vcc_supply );
498
+
499
+ return ret ;
489
500
}
490
501
491
502
static void nb7vpq904m_remove (struct i2c_client * client )
0 commit comments