kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <graf@amazon.de>
To: Andra Paraschiv <andraprs@amazon.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Cc: Anthony Liguori <aliguori@amazon.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Colm MacCarthaigh <colmmacc@amazon.com>,
	"David Duncan" <davdunc@amazon.com>,
	Bjoern Doebel <doebel@amazon.de>,
	"David Woodhouse" <dwmw@amazon.co.uk>,
	Frank van der Linden <fllinden@amazon.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Karen Noel <knoel@redhat.com>,
	Martin Pohlack <mpohlack@amazon.de>, Matt Wilson <msw@amazon.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Stewart Smith <trawets@amazon.com>,
	Uwe Dannowski <uwed@amazon.de>,
	Vitaly Kuznetsov <vkuznets@redhat.com>, kvm <kvm@vger.kernel.org>,
	ne-devel-upstream <ne-devel-upstream@amazon.com>
Subject: Re: [PATCH v1] nitro_enclaves: Fixup type of the poll result assigned value
Date: Mon, 2 Nov 2020 17:16:51 +0100	[thread overview]
Message-ID: <e4a34429-1b25-00d5-9bf1-045ca49acb8d@amazon.de> (raw)
In-Reply-To: <20201014090500.75678-1-andraprs@amazon.com>



On 14.10.20 11:05, Andra Paraschiv wrote:
> Update the assigned value of the poll result to be EPOLLHUP instead of
> POLLHUP to match the __poll_t type.
> 
> Signed-off-by: Andra Paraschiv <andraprs@amazon.com>
> Reported-by: kernel test robot <lkp@intel.com>
> ---
>   drivers/virt/nitro_enclaves/ne_misc_dev.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev.c b/drivers/virt/nitro_enclaves/ne_misc_dev.c
> index f06622b48d69..9148566455e8 100644
> --- a/drivers/virt/nitro_enclaves/ne_misc_dev.c
> +++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c
> @@ -1508,7 +1508,7 @@ static __poll_t ne_enclave_poll(struct file *file, poll_table *wait)
>   	if (!ne_enclave->has_event)
>   		return mask;
>   
> -	mask = POLLHUP;
> +	mask = EPOLLHUP;

That whole function looks a bit ... convoluted? How about this? I guess 
you could trim it down even further, but this looks quite readable to me:

diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev.c 
b/drivers/virt/nitro_enclaves/ne_misc_dev.c
index f06622b48d69..5b7f45e2eb4c 100644
--- a/drivers/virt/nitro_enclaves/ne_misc_dev.c
+++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c
@@ -1505,10 +1505,8 @@ static __poll_t ne_enclave_poll(struct file 
*file, poll_table *wait)

  	poll_wait(file, &ne_enclave->eventq, wait);

-	if (!ne_enclave->has_event)
-		return mask;
-
-	mask = POLLHUP;
+	if (ne_enclave->has_event)
+		mask |= POLLHUP;

  	return mask;
  }


Alex



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879




  reply	other threads:[~2020-11-02 16:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14  9:05 [PATCH v1] nitro_enclaves: Fixup type of the poll result assigned value Andra Paraschiv
2020-11-02 16:16 ` Alexander Graf [this message]
2020-11-02 17:42   ` Paraschiv, Andra-Irina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e4a34429-1b25-00d5-9bf1-045ca49acb8d@amazon.de \
    --to=graf@amazon.de \
    --cc=aliguori@amazon.com \
    --cc=andraprs@amazon.com \
    --cc=benh@kernel.crashing.org \
    --cc=colmmacc@amazon.com \
    --cc=davdunc@amazon.com \
    --cc=doebel@amazon.de \
    --cc=dwmw@amazon.co.uk \
    --cc=fllinden@amazon.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=knoel@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpohlack@amazon.de \
    --cc=msw@amazon.com \
    --cc=ne-devel-upstream@amazon.com \
    --cc=pbonzini@redhat.com \
    --cc=sgarzare@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=trawets@amazon.com \
    --cc=uwed@amazon.de \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).