Re: [PATCH v2 3/4] hwmon: Add support for Amphenol ChipCap 2

From: Krzysztof Kozlowski
Date: Thu Nov 09 2023 - 11:18:32 EST


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.

Best regards,
Krzysztof