}
/* Enable power to APB */
- if (apb->vcore) {
+ if (!IS_ERR(apb->vcore)) {
ret = regulator_enable(apb->vcore);
if (ret) {
dev_err(dev, "failed to enable core regulator\n");
return ret;
}
}
- if (apb->vio) {
+ if (!IS_ERR(apb->vio)) {
ret = regulator_enable(apb->vio);
if (ret) {
dev_err(dev, "failed to enable IO regulator\n");
/* Regulators are optional, as we may have fixed supply coming in */
apb->vcore = devm_regulator_get(dev, "vcore");
- if (IS_ERR(apb->vcore)) {
+ if (IS_ERR(apb->vcore))
dev_info(dev, "no core regulator found\n");
- apb->vcore = NULL;
- }
apb->vio = devm_regulator_get(dev, "vio");
- if (IS_ERR(apb->vio)) {
+ if (IS_ERR(apb->vio))
dev_info(dev, "no IO regulator found\n");
- apb->vio = NULL;
- }
apb->pinctrl = devm_pinctrl_get(&pdev->dev);
if (IS_ERR(apb->pinctrl)) {
{
unsigned long flags;
- if (apb->vcore && regulator_is_enabled(apb->vcore) > 0)
+ if (!IS_ERR(apb->vcore) && regulator_is_enabled(apb->vcore) > 0)
regulator_disable(apb->vcore);
- if (apb->vio && regulator_is_enabled(apb->vio) > 0)
+ if (!IS_ERR(apb->vio) && regulator_is_enabled(apb->vio) > 0)
regulator_disable(apb->vio);
spin_lock_irqsave(&apb->lock, flags);