Skip to contentSkip to conversation

opp: core: add regulators enable and disable

bug report Dan Carpenter 1 participant 1 message May 19, 2020

lore
Share & tools
lore
#0 lore raw

Hello Kamil Konieczny,

This is a semi-automatic email about new static checker warnings.

The patch f4111e2e1ae1: "opp: core: add regulators enable and disable" from Jul 19, 2019, leads to the following Smatch complaint:

    drivers/opp/core.c:846 dev_pm_opp_set_rate()
    error: we previously assumed 'opp_table->regulators' could be null (see line 840)

drivers/opp/core.c
839

   840			if (!opp_table->required_opp_tables && !opp_table->regulators) {
                                                            ^^

Should this && be ||?

   841				dev_err(dev, "target frequency can't be 0\n");
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^

This error message is confusing.

842 ret = -EINVAL;
843 }
844
845 if (opp_table->regulator_enabled) {

   846				regulator_disable(opp_table->regulators[0]);
                                                  ^^^^^^^^^^^^^^^^^^^^^

Unchecked dereference.

   847				opp_table->regulator_enabled = false;
   848			}

regards,
dan carpenter