[PATCH 6/6] powerpc: powernv: no need to check return value of debugfs_create functions
Michael Ellerman
mpe at ellerman.id.au
Tue Mar 3 20:52:20 AEDT 2020
"Oliver O'Halloran" <oohall at gmail.com> writes:
> On Mon, Feb 10, 2020 at 12:12 AM Greg Kroah-Hartman
> <gregkh at linuxfoundation.org> wrote:
>>
>> When calling debugfs functions, there is no need to ever check the
>> return value. The function can work or not, but the code logic should
>> never do something different based on this.
>
> For memtrace debugfs is the only way to actually use the feature. It'd
> be nice if it still printed out *something* if it failed to create the
> files rather than just being mysteriously absent
That's true, but the current code doesn't actually do that anyway.
>> diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
>> index eb2e75dac369..d6d64f8718e6 100644
>> --- a/arch/powerpc/platforms/powernv/memtrace.c
>> +++ b/arch/powerpc/platforms/powernv/memtrace.c
>> @@ -187,11 +187,6 @@ static int memtrace_init_debugfs(void)
>>
>> snprintf(ent->name, 16, "%08x", ent->nid);
>> dir = debugfs_create_dir(ent->name, memtrace_debugfs_dir);
>> - if (!dir) {
>> - pr_err("Failed to create debugfs directory for node %d\n",
>> - ent->nid);
>> - return -1;
>> - }
debugfs_create_dir() doesn't return NULL on error, it returns
ERR_PTR(-ENOMEM), which will not trigger that pr_err().
So I've merged this and if someone wants to they can send a follow-up to
do proper error checking in memtrace.c
cheers
More information about the Linuxppc-dev
mailing list