Re: [PATCH v3 12/29] platform/x86: ideapad-laptop: check return value of debugfs_create_dir() for errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 2/4/21 1:21 PM, Barnabás Pőcze wrote:
> Hi
> 
> 
> 2021. február 4., csütörtök 9:12 keltezéssel, Hans de Goede írta:
> 
>> Hi Barnabás,
>>
>> On 2/3/21 10:55 PM, Barnabás Pőcze wrote:
>>
>>> debugfs_create_dir() may return an ERR_PTR(),
>>> add a check to ideapad_debugfs_init() that
>>> handles the case when that occurs.
>>
>> debugfs functions should not be error-checked:
>>
>> 1.  They are for debugging so if they don't work it is not an issue
>>     (note your own error handling also just returns without propagating
>>     the error).
>>
>> 2.  Subsequent debugfs calls taking the ERR-PTR will detect this and
>>     turn into no-op-s
>> [...]
> 
> My idea was to prevent the ERR_PTR() from being passed to
> debugfs_create_file() because I was not aware that it checked
> for that, so thanks for catching it!

I understand, debugfs functions are special, because normally
error checking return values is encouraged, but with debugfs
functions there is an (unwritten?) rule that they should not be
error checked.

Regards,

Hans




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux