public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Mc Guire <der.herr@hofr.at>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Nicholas Mc Guire <hofrat@osadl.org>,
	David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] DRM: Armada: fixup wait_event_timeout being ignored
Date: Wed, 10 Jun 2015 13:48:45 +0200	[thread overview]
Message-ID: <20150610114845.GA9921@opentech.at> (raw)
In-Reply-To: <20150610112235.GL7557@n2100.arm.linux.org.uk>

On Wed, 10 Jun 2015, Russell King - ARM Linux wrote:

> On Wed, Jun 10, 2015 at 01:07:08PM +0200, Nicholas Mc Guire wrote:
> > The calling side seems to assume 0 as success and <0 as error so 
> > returning -ETIME should be fine here.
> 
> The idea here is to allow the remainder of the code to execute when
> the condition succeeds _or_ times out.  If it times out, that is
> not a failure - it merely means that the display has been blanked
> and we're not seeing frame done interrupts anymore.
> 
> The code should not be checking the returned value at all - in fact
> I have updates to this code which (in part) remove this, and fix a
> glaring problem that the wait queue is never woken.
> 
> I wonder how many places you've made this same mistake... please
> ensure that you review the code you're changing carefully.
>

Sorry for that - I do try my best to understand the code - my obviously
wrong understanding of the code was that a negative return was being 
expected as being possible and then handed back to the caller so I 
assumed that would be the timeout case - but as this can never happen it 
was basically ignoring the timeout - that the execution should continue 
in the case of timeout being reached was not clear to me (it might be 
worth a comment ?)

I did find similar cases in other drivers 
./drivers/media/platform/s5p-tv/mixer_reg.c:364
        incorrect check for negative return
checking for < 0 and returning (so unreachable return statement with no 
effect but no side-effect in that condition ither) or 
./drivers/media/pci/ddbridge/ddbridge-core.c:89
        incorrect check for negative return
which checked for <= 0 and was fixed up to == 0 which is correct as the < 0
case simply is unreachable - so no change of error handling logic.

but those two other cases I think are correctly fixed up.

thx!
hofrat

      reply	other threads:[~2015-06-10 11:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-10 11:07 [PATCH] DRM: Armada: fixup wait_event_timeout being ignored Nicholas Mc Guire
2015-06-10 11:22 ` Russell King - ARM Linux
2015-06-10 11:48   ` Nicholas Mc Guire [this message]

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=20150610114845.GA9921@opentech.at \
    --to=der.herr@hofr.at \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hofrat@osadl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    /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