<div dir="ltr"><div>> Still I think this patch is an improvement so I'll plan to merge it.</div><div><br></div><div>Please let me know when you commit it.</div><div><br></div><div>Thanks</div><div>Immad.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 30, 2023 at 4:17 PM Michael Ellerman <<a href="mailto:mpe@ellerman.id.au">mpe@ellerman.id.au</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Greg KH <<a href="mailto:gregkh@linuxfoundation.org" target="_blank">gregkh@linuxfoundation.org</a>> writes:<br>
> On Sun, May 28, 2023 at 01:16:44PM +0530, <a href="mailto:mirimmad@outlook.com" target="_blank">mirimmad@outlook.com</a> wrote:<br>
>> From: Immad Mir <<a href="mailto:mirimmad17@gmail.com" target="_blank">mirimmad17@gmail.com</a>><br>
>> <br>
>> The debugfs_create_dir returns ERR_PTR incase of an error and the<br>
>> correct way of checking it by using the IS_ERR inline function, and<br>
>> not the simple null comparision. This patch fixes this.<br>
>> <br>
>> Suggested-By: Ivan Orlov <<a href="mailto:ivan.orlov0322@gmail.com" target="_blank">ivan.orlov0322@gmail.com</a>><br>
>> Signed-off-by: Immad Mir <<a href="mailto:mirimmad17@gmail.com" target="_blank">mirimmad17@gmail.com</a>><br>
>> ---<br>
>> arch/powerpc/platforms/powernv/opal-xscom.c | 4 ++--<br>
>> 1 file changed, 2 insertions(+), 2 deletions(-)<br>
>> <br>
>> diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c b/arch/powerpc/platforms/powernv/opal-xscom.c<br>
>> index 6b4eed2ef..262cd6fac 100644<br>
>> --- a/arch/powerpc/platforms/powernv/opal-xscom.c<br>
>> +++ b/arch/powerpc/platforms/powernv/opal-xscom.c<br>
>> @@ -168,7 +168,7 @@ static int scom_debug_init_one(struct dentry *root, struct device_node *dn,<br>
>> ent->path.size = strlen((char *)ent->path.data);<br>
>> <br>
>> dir = debugfs_create_dir(ent->name, root);<br>
>> - if (!dir) {<br>
>> + if (IS_ERR(dir)) {<br>
>> kfree(ent->path.data);<br>
>> kfree(ent);<br>
>> return -1;<br>
><br>
> Why is this driver caring if debugfs is working or not at all? It<br>
> should just ignore the error and keep moving forward.<br>
<br>
It's creating directories and then creating files in those directories.<br>
So I think it makes sense that it checks that the directory was created<br>
successfully. It doesn't check whether the files were created.<br>
<br>
> And -1 is not a valid error number :(<br>
<br>
It's EPERM :) - but yeah probably not really the right error in this<br>
case.<br>
<br>
Still I think this patch is an improvement so I'll plan to merge it.<br>
<br>
cheers<br>
</blockquote></div>