Hi David and Mark!

On 7/21/26 8:24 PM, David Hildenbrand (Arm) wrote:
> On 7/21/26 15:48, Mark Brown wrote:
>> On Tue, Jul 21, 2026 at 03:39:09PM +0200, David Hildenbrand (Arm) wrote:
>>> On 7/16/26 14:32, Sarthak Sharma wrote:
>>
>>>>    fd = open(path, O_RDONLY);
>>>> -  if (fd == -1)
>>>> -          return 0;
>>>> +  if (fd == -1) {
>>>> +          int err = errno;
>>>> +
>>>> +          printf("# %s: %s (%d)\n", path, strerror(err), err);
>>
>>> Shouldn't we be using
>>
>>> ksft_print_msg()
>>
>>> That does the magic "# " for us.
>>
>> Or ksft_perror().
> 
> 
> Right, and if we want to move this to tools/lib/mm later, maybe we can just 
> not
> print anything and instead only return expressive errnos.
> 

Yes, we are not using ksft_* prints here because these functions move to
tools/lib/mm later in the series.

Printing errors from the helpers was suggested by Mike [1]. I also think
this is useful since the diagnostic handling stays at one place, instead
of duplicating it in every caller.

If we want helpers to be silent, I can change them to return errors and
let the callers handle the diagnostics. Please let me know how I should
proceed here.

[1]
https://lore.kernel.org/all/178048086818.472368.16811711474077698399.b4-review@b4/

Reply via email to