gpio: mvebu: Make use of devm_pwmchip_add
[platform/kernel/linux-starfive.git] / drivers / mfd / stmpe.c
index a92301d..9c3cf58 100644 (file)
@@ -1485,9 +1485,9 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum)
 
 void stmpe_remove(struct stmpe *stmpe)
 {
-       if (!IS_ERR(stmpe->vio))
+       if (!IS_ERR(stmpe->vio) && regulator_is_enabled(stmpe->vio))
                regulator_disable(stmpe->vio);
-       if (!IS_ERR(stmpe->vcc))
+       if (!IS_ERR(stmpe->vcc) && regulator_is_enabled(stmpe->vcc))
                regulator_disable(stmpe->vcc);
 
        __stmpe_disable(stmpe, STMPE_BLOCK_ADC);