qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bandan Das <bsd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Bug 1798780 <1798780@bugs.launchpad.net>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [Bug 1798780] [NEW] hw/usb/dev-mtp.c:1616: bad test ?
Date: Tue, 22 Jan 2019 07:38:43 -0500	[thread overview]
Message-ID: <jpgd0ooc1f0.fsf@linux.bootlegged.copy> (raw)
In-Reply-To: CAFEAcA9vczSpf+xd+3so1YKAW-d4RKY7iVEtMvJrgSNbRjQ+Zg@mail.gmail.com

Peter Maydell <peter.maydell@linaro.org> writes:

> On Fri, 19 Oct 2018 at 10:22, dcb <1798780@bugs.launchpad.net> wrote:
>> hw/usb/dev-mtp.c:1616:52: warning: logical ‘or’ of collectively
>> exhaustive tests is always true [-Wlogical-op]
>>
>> Source code is
>>
>>                 if ((ret == -1) && (errno != EINTR || errno != EAGAIN ||
>>                                     errno != EWOULDBLOCK)) {
>>
>> Maybe better code
>>
>>                 if ((ret == -1) && (errno != EINTR && errno != EAGAIN &&
>>                                     errno != EWOULDBLOCK)) {
>
> Hi Gerd, Bandan -- I was going through older launchpad bugs and
> noticed that this one about a dubious conditional in dev-mtp.c is
> still unfixed.
>
> Is the file descriptor being used here one that's in non-blocking
> mode? If so, then busy-waiting in a loop while the write() returns
> EWOULDBLOCK is probably not what you wanted. If it's not then
> there's no need to check for EAGAIN or EWOULDBLOCK, I think.
> Consider using qemu_write_full() instead of open-coding
> the retry loop ?
>

Thanks for the suggestion, Peter. I agree, this isn't
non-blocking and qemu_write_full() can be used. Following up
with a patch.

Bandan

> thanks
> -- PMM

  reply	other threads:[~2019-01-22 18:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19  9:07 [Qemu-devel] [Bug 1798780] [NEW] hw/usb/dev-mtp.c:1616: bad test ? dcb
2019-01-18 17:18 ` Peter Maydell
2019-01-22 12:38   ` Bandan Das [this message]
2019-01-22 12:41     ` [Qemu-devel] [PATCH] usb-mtp: replace the homebrew write with qemu_write_full Bandan Das
2019-01-24  8:01       ` Gerd Hoffmann
2019-01-24  8:19         ` Bandan Das
2019-01-24  8:31           ` Gerd Hoffmann
2019-04-24  6:07 ` [Qemu-devel] [Bug 1798780] Re: hw/usb/dev-mtp.c:1616: bad test ? Thomas Huth
2019-04-24  6:07   ` Thomas Huth

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=jpgd0ooc1f0.fsf@linux.bootlegged.copy \
    --to=bsd@redhat.com \
    --cc=1798780@bugs.launchpad.net \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).