On 11/9/23 08:18, Krzysztof Kozlowski wrote:
On 09/11/2023 15:55, Guenter Roeck wrote:
+ 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.
This actually follows Documentation/process/coding-style.rst, chapter 7
(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.
Agreed, you have a point.
Thanks,
Guenter