On 09/11/2023 15:55, Guenter Roeck wrote:
This actually follows Documentation/process/coding-style.rst, chapter 7+ if (IS_ERR(data->hwmon)) {
+ ret = PTR_ERR(data->hwmon);
+ goto cleanup;
+ }
+
+ return 0;
+
+cleanup:
+ if (cc2_disable(data))
+ dev_dbg(dev, "Failed to disable device");
+
+ return dev_err_probe(dev, ret,
+ "Unable to register hwmon device\n");
Drop or move to each error path.
(Centralized exiting of functions).
The point is that centralized message of error is useless. Probe failure
is already handled by core, thus another message doing the same is
redundant. What is needed to explain the true reason of failure, thus
the error message should be next to each type of failure. Missing
regulator? Say it. Missing clock? Say something else.