Re: [PATCH] fs: eventfd: fix obsolete comment

From: linmiaohe
Date: Sun Dec 08 2019 - 21:44:26 EST


Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>On Sat, Dec 07, 2019 at 03:45:33PM +0800, linmiaohe wrote:
>> From: Miaohe Lin <linmiaohe@xxxxxxxxxx>
>>
>> *
>> - * eventfd_fget
>> + * fdget
>
>But this is wrong. The error pointer is returned from eventfd_ctx_fileget(), not from fdget.
>
>Looking at the three callers of eventfd_ctx_fileget(), I think it would make sense to do this:

Many thanks for your review and nice advice. But I think this patch should belong to you as you found this.
I really did nothing about it. Maybe a Reviewed-by tag for me is enough.

>diff --git a/drivers/vfio/virqfd.c b/drivers/vfio/virqfd.c index 997cb5d0a657..c35b614e3770 100644
>--- a/drivers/vfio/virqfd.c
>+++ b/drivers/vfio/virqfd.c
>@@ -126,11 +126,6 @@ int vfio_virqfd_enable(void *opaque,
> INIT_WORK(&virqfd->inject, virqfd_inject);
>
> irqfd = fdget(fd);
>- if (!irqfd.file) {
>- ret = -EBADF;
>- goto err_fd;
>- }
>-
> ctx = eventfd_ctx_fileget(irqfd.file);
> if (IS_ERR(ctx)) {
> ret = PTR_ERR(ctx);

The err_fd label should further be removed, as after this change, it's no longer used.
Other callers should drop unused jump label too.

>(not even compile tested)

Thanks again.