Commit f775f6d1 authored by Javier Carrasco's avatar Javier Carrasco Committed by Guenter Roeck

hwmon: (chipcap2) Drop cc2_disable() in the probe and return dev_err_probe()

There is no need to actively disable a regulator that has not been
enabled by the driver, which makes the call to cc2_disable() in the
probe function meaningless, because the probe function never enables
the device's dedicated regulator.

Once the call to cc2_disable() is dropped, the error paths can directly
return dev_err_probe() in all cases.
Signed-off-by: default avatarJavier Carrasco <javier.carrasco.cruz@gmail.com>
Message-ID: <20240813-chipcap2-probe-improvements-v2-1-e9a2932a8a00@gmail.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 05aa8cbe
...@@ -740,37 +740,26 @@ static int cc2_probe(struct i2c_client *client) ...@@ -740,37 +740,26 @@ static int cc2_probe(struct i2c_client *client)
data->client = client; data->client = client;
data->regulator = devm_regulator_get_exclusive(dev, "vdd"); data->regulator = devm_regulator_get_exclusive(dev, "vdd");
if (IS_ERR(data->regulator)) { if (IS_ERR(data->regulator))
dev_err_probe(dev, PTR_ERR(data->regulator), return dev_err_probe(dev, PTR_ERR(data->regulator),
"Failed to get regulator\n"); "Failed to get regulator\n");
return PTR_ERR(data->regulator);
}
ret = cc2_request_ready_irq(data, dev); ret = cc2_request_ready_irq(data, dev);
if (ret) { if (ret)
dev_err_probe(dev, ret, "Failed to request ready irq\n"); return dev_err_probe(dev, ret, "Failed to request ready irq\n");
return ret;
}
ret = cc2_request_alarm_irqs(data, dev); ret = cc2_request_alarm_irqs(data, dev);
if (ret) { if (ret)
dev_err_probe(dev, ret, "Failed to request alarm irqs\n"); return dev_err_probe(dev, ret, "Failed to request alarm irqs\n");
goto disable;
}
data->hwmon = devm_hwmon_device_register_with_info(dev, client->name, data->hwmon = devm_hwmon_device_register_with_info(dev, client->name,
data, &cc2_chip_info, data, &cc2_chip_info,
NULL); NULL);
if (IS_ERR(data->hwmon)) { if (IS_ERR(data->hwmon))
dev_err_probe(dev, PTR_ERR(data->hwmon), return dev_err_probe(dev, PTR_ERR(data->hwmon),
"Failed to register hwmon device\n"); "Failed to register hwmon device\n");
ret = PTR_ERR(data->hwmon);
}
disable:
cc2_disable(data);
return ret; return 0;
} }
static void cc2_remove(struct i2c_client *client) static void cc2_remove(struct i2c_client *client)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment