"Failed to acquire orientation-switch\n");
 
        ret = regulator_enable(ptn->vdd18_supply);
-       if (ret)
-               return dev_err_probe(dev, ret, "Failed to enable vdd18\n");
+       if (ret) {
+               ret = dev_err_probe(dev, ret, "Failed to enable vdd18\n");
+               goto err_switch_put;
+       }
 
        ret = ptn36502_detect(ptn);
        if (ret)
 err_disable_regulator:
        regulator_disable(ptn->vdd18_supply);
 
+err_switch_put:
+       typec_switch_put(ptn->typec_switch);
+
        return ret;
 }
 
        typec_switch_unregister(ptn->sw);
 
        regulator_disable(ptn->vdd18_supply);
+
+       typec_switch_put(ptn->typec_switch);
 }
 
 static const struct i2c_device_id ptn36502_table[] = {