if (ret < 0)
return ret;
- ret = regulator_enable(csid->vdda);
+ ret = csid->vdda ? regulator_enable(csid->vdda) : 0;
if (ret < 0) {
pm_runtime_put_sync(dev);
return ret;
ret = csid_set_clock_rates(csid);
if (ret < 0) {
- regulator_disable(csid->vdda);
+ if (csid->vdda)
+ regulator_disable(csid->vdda);
pm_runtime_put_sync(dev);
return ret;
}
ret = camss_enable_clocks(csid->nclocks, csid->clock, dev);
if (ret < 0) {
- regulator_disable(csid->vdda);
+ if (csid->vdda)
+ regulator_disable(csid->vdda);
pm_runtime_put_sync(dev);
return ret;
}
if (ret < 0) {
disable_irq(csid->irq);
camss_disable_clocks(csid->nclocks, csid->clock);
- regulator_disable(csid->vdda);
+ if (csid->vdda)
+ regulator_disable(csid->vdda);
pm_runtime_put_sync(dev);
return ret;
}
} else {
disable_irq(csid->irq);
camss_disable_clocks(csid->nclocks, csid->clock);
- ret = regulator_disable(csid->vdda);
+ ret = csid->vdda ? regulator_disable(csid->vdda) : 0;
pm_runtime_put_sync(dev);
}
/* Regulator */
- csid->vdda = devm_regulator_get(dev, res->regulator[0]);
+ csid->vdda = NULL;
+ if (res->regulator[0])
+ csid->vdda = devm_regulator_get(dev, res->regulator[0]);
if (IS_ERR(csid->vdda)) {
dev_err(dev, "could not get regulator\n");
return PTR_ERR(csid->vdda);